%%
%% This is the original source file advi.sty
%%
%% Package `commandline' to use with LaTeX 2e
%% Copyright Didier Remy.
%% All rights reserved.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{argv}
         [2001/29/08 v0.40 Argv Package for parsing command line options]

%%

%% Identification
%% Preliminary declarations

\RequirePackage {keyval}

%% Options

\newif \ifrun@argv
\DeclareOption {run}{\run@argvtrue}
\ProcessOptions

%% More Declarations

\def \defargv {\define@key{argv}}

\def \runargv
  {\@ifundefined{argv}
    {\@ifundefined{defaultargv}{}
     {\def \do {\setkeys{argv}}\expandafter \do \expandafter {\defaultargv}}}
    {\def \do {\setkeys{argv}}\expandafter \do \expandafter {\argv}}}

%% Some predefine keys

\defargv {set}[]{\csname #1true\endcsname}
\defargv {unset}[]{\csname #1false\endcsname}
\defargv {eval}[]{#1}

\defargv {ignoreadvi}[]{\PassOptionsToPackage{ignore}{advi}}
\defargv {use}{\AtEndOfPackage{\RequirePackage{#1}}}
\defargv {driver}{\rundriver {#1}}
\def \rundriver #1{\@ifundefined {argv@#1@}
   {\PackageWarning {Argv}{Undefined driver #1}{}}
   {\message{Driver=#1}\@nameuse {argv@#1@}}}

\def \do #1{
  \expandafter \def \csname argv@#1@\endcsname {%
    \PassOptionsToPackage{ignore}{advi}%
    \PassOptionsToPackage{#1}{hyperref}%
    \PassOptionsToPackage{#1}{bubble}%
    \PassOptionsToPackage{#1}{pst}%
    \PassOptionsToPackage{#1}{graphicx}%
  }}
\do {dvipdfm}
\do {dvips}
\do {pdftex}
\expandafter \def \csname argv@ps2pdf@\endcsname 
  {\PassOptionsToPackage{ignore}{advi}%
   \PassOptionsToPackage{ps2pdf}{hyperref}}
\def \argv@hypertex@ {%
    \PassOptionsToPackage{hypertex}{hyperref}%
}

\let \do \relax

\ifrun@argv
\runargv
\fi

\endinput
