<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#-*- perl -*-

## Copyright (C) 2002 R Development Core Team
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## A copy of the GNU General Public License is available via WWW at
## http://www.gnu.org/copyleft/gpl.html.  You can also obtain it by
## writing to the Free Software Foundation, Inc., 59 Temple Place,
## Suite 330, Boston, MA  02111-1307  USA.
##
## Send any bug reports to r-bugs@r-project.org

use Getopt::Long;
use R::Rdconv;
use R::Rdtools;
use R::Utils;
use R::Vars;

my $revision = ' $Revision: 1.1.10.1 $ ';
my $version;
my $name;

$revision =~ / ([\d\.]*) /;
$version = $1;
($name = $0) =~ s|.*/||;

sub usage {
    print STDERR &lt;&lt;END;
Usage: [R CMD] perl /path/to/extract-examples.pl [options] FILE OUT

Extract examples from the Rd source file FILE, writing results to OUT.

Options:
  -h, --help            print short help message and exit
  -v, --version         print version info and exit
      --os=NAME         use OS type NAME (unix or windows)
      --OS=NAME         the same as '--os'
  -V, --verbose         print more information about progress

Email bug reports to &lt;r-bugs\@r-project.org&gt;.
END
  exit 0;
}

my $opt_OS = $R::Vars::OSTYPE;
my $opt_version;
my $opt_verbose;

## &lt;NOTE&gt;
## Used in Rdconv.pm and Rdlists.pm ...
my $OSdir = $R::Vars::OSTYPE;
## &lt;/NOTE&gt;

GetOptions("h|help"    =&gt; \&amp;usage,
	   "v|version" =&gt; \$opt_version,
	   "os|OS:s"   =&gt; \$opt_OS,
	   "V|verbose" =&gt; \$opt_verbose
	  ) or &amp;usage();

&amp;R_version($name, $version) if $opt_version;

Rdconv($ARGV[0], "example", "", $ARGV[1]);

</pre></body></html>