[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.5 Command Line Syntax

The command line parameters that follow the virtual code file name when avram is used in parameter mode (Parameter Mode) are dependent on the specific application. However, all supported applications are constrained for implementation reasons to observe certain uniform conventions regarding their command line parameters, which are documented here to avoid needless duplication.

The shell divides the command line into "arguments" separated by white space. Arguments containing white space or special characters used by the shell must be quoted or protected as usual. File names with wild cards in them are expanded by the shell before avram sees them.

avram then extracts from the sequence of arguments a sequence of filenames and a sequence of options. Each option consists of a keyword and an optional parameter list. Filenames, keywords, and parameter lists are distinguished according to the following criteria.

  1. An argument is treated as a keyword iff it meets these three conditions.
    1. It starts with a dash.
    2. It doesn’t contain an equals sign.
    3. It doesn’t consist solely of a dash.
  2. An argument is treated as a parameter list iff it meets these four conditions.
    1. It doesn’t begin with a dash.
    2. It either begins with an equals sign or doesn’t contain one.
    3. It immediately follows an argument beginning with a dash, not containing an equals sign and not consisting solely of a dash.
    4. At least one of the following is true.
      1. It doesn’t contain a period, tilde, or path separator.
      2. It contains a comma.
      3. It can be interpreted as a C formatted floating point number.
  3. An argument is treated as an input file name iff it meets these four conditions.
    1. It doesn’t begin with a dash.
    2. It doesn’t contain an equals sign.
    3. It doesn’t contain a comma.
    4. At least one of the following is true.
      1. It contains a period, tilde, or path separator.
      2. It doesn’t immediately follow an argument beginning with a dash, not consisting solely of a dash, and not containing an equals sign.
  4. If an argument contains an equals sign but doesn’t begin with one, the part on the left of the first equals sign is treated as a keyword and the part on the right is treated as a parameter list.
  5. An argument consisting solely of a dash is taken to represent the standard input file.
  6. An argument not fitting any of the above classifications is an error.

These conventions are needed for avram to detect input file names in a general, position independent way, so that it can preload the files on behalf of the application. Many standard Unix utilities follow these conventions to a large extent, the exceptions being those that employ non-filename arguments without distinguishing syntax, and use positional or other ad hoc methods of command line interpretation. A drop-in replacement for such an application could nevertheless be implemented using avram with an appropriate wrapper script, similar to the approach recommended in Example Script, but with suitable keywords inserted prior to the ambiguous arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November 8, 2012 using texi2html 1.82.