The R Project SVN R

Rev

Rev 7335 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7335 Rev 7380
Line 24... Line 24...
24
 
24
 
25
use Getopt::Long;
25
use Getopt::Long;
26
use File::Basename;
26
use File::Basename;
27
use Cwd;
27
use Cwd;
28
 
28
 
-
 
29
my $revision = ' $Revision: 1.9 $ ';
-
 
30
my $version;
-
 
31
my $name;
-
 
32
 
-
 
33
$revision =~ / ([\d\.]*) /;
-
 
34
$version = $1;
-
 
35
($name = $0) =~ s|.*/||;
-
 
36
 
-
 
37
sub version {
-
 
38
  print STDERR <<END;
-
 
39
Rdconv $version
-
 
40
Copyright (C) 1997 Fritz Leisch.
-
 
41
This is free software; see the GNU General Public Licence version 2
-
 
42
or later for copying conditions.  There is NO warranty.    
-
 
43
END
-
 
44
  exit 0;
-
 
45
}
-
 
46
 
-
 
47
sub usage {
-
 
48
  print STDERR <<END;
-
 
49
Usage: $name [options] FILE
-
 
50
 
-
 
51
Convert R documentation in FILE to other formats such as plain text,
-
 
52
HTML or LaTeX.
-
 
53
 
-
 
54
Options:
-
 
55
  -h, --help		print short help message and exit
-
 
56
  -v, --version		print version info and exit
-
 
57
  -d, --debug		turn on debugging (increase verbosity)
-
 
58
  -t, --type=TYPE	convert to format TYPE
-
 
59
  --os=NAME		use OS subdir \`NAME\' (unix, mac or windows)
-
 
60
  --OS=NAME		the same as --os.
-
 
61
 
-
 
62
Possible format specificiations are html, nroff, latex, txt (plain
-
 
63
text), Sd (S documentation format), and example (extract R code in the
-
 
64
examples).
-
 
65
  
-
 
66
Email bug reports to <r-bugs\@lists.r-project.org>.
-
 
67
END
-
 
68
  exit 0;
-
 
69
}
-
 
70
 
29
$OSdir ="unix";
71
my $OSdir ="unix";
30
 
72
 
31
$cwd=getcwd();
73
$cwd=getcwd();
32
if($ENV{"R_HOME"}){
74
if($ENV{"R_HOME"}){
33
    $R_HOME=$ENV{"R_HOME"};
75
    $R_HOME=$ENV{"R_HOME"};
34
}
76
}
Line 39... Line 81...
39
 
81
 
40
chdir($cwd);
82
chdir($cwd);
41
 
83
 
42
require "$R_HOME/etc/Rdconvlib.pl";
84
require "$R_HOME/etc/Rdconvlib.pl";
43
 
85
 
44
@knownoptions = ("debug|d", "type|t:s", "help|h", "os|OS:s");
86
@knownoptions = ("debug|d", "type|t:s", "h|help", "v|version",
-
 
87
		 "os|OS:s");
45
GetOptions (@knownoptions) || usage();
88
GetOptions (@knownoptions) || &usage();
-
 
89
&version() if $opt_v;
-
 
90
&usage() if $opt_h;
46
 
91
 
47
$OSdir = $opt_os if $opt_os;
92
$OSdir = $opt_os if $opt_os;
48
 
93
 
49
usage() if $opt_help;
94
usage() if $opt_help;
50
print stderr "R_HOME: '$R_HOME';  cwd='$cwd'\n" if $opt_debug;
95
print stderr "R_HOME: '$R_HOME';  cwd='$cwd'\n" if $opt_debug;
Line 66... Line 111...
66
    Rdconv($ARGV[0],$opt_type,$opt_debug, 0);
111
    Rdconv($ARGV[0],$opt_type,$opt_debug, 0);
67
}
112
}
68
else {
113
else {
69
    Rdconv($ARGV[0],$opt_type,$opt_debug, 0, -1);
114
    Rdconv($ARGV[0],$opt_type,$opt_debug, 0, -1);
70
}
115
}
71
 
-
 
72
 
-
 
73
 
-
 
74
 
-
 
75
sub usage {
-
 
76
 
-
 
77
    print "Rdconv\n";
-
 
78
    print "Usage: Rdconv [--debug/-d] [--help/-h] [--os/--OS unix|mac|windows]";
-
 
79
    print " [--type/-t html|nroff|txt|Sd|latex|example] file\n\n";
-
 
80
    exit 0;
-
 
81
}
-