Browse Prior Art Database

Generic Command Line Parser

IP.com Disclosure Number: IPCOM000112365D
Original Publication Date: 1994-May-01
Included in the Prior Art Database: 2005-Mar-27
Document File: 4 page(s) / 101K

Publishing Venue

IBM

Related People

Murphy, MI: AUTHOR

Abstract

Disclosed is a process for parsing the command line arguments of each device driver which may be added to IBM OS/2* 2.O by means of the CONFIG.SYS file.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 46% of the total text.

Generic Command Line Parser

      Disclosed is a process for parsing the command line arguments
of each device driver which may be added to IBM OS/2* 2.O by means of
the CONFIG.SYS file.

      The IBM OS/2 2.0 operating system includes a configuration
file, CONFIG.SYS, which contains a number of statements responsible
for defining the functionality of the operating system at load time.
Statements are written to adhere to a strict syntax, as shown in Fig.
1, with "BASEDEV=" followed by a filename, which is in turn followed
by a number of arguments.  The filename parameter contains the name
of the base device driver, and the device supported by the driver
determines which arguments can be valid.  Since the parsing process
allows for the development of unique command line statements with
various arguments, it is useful, not only for "BASEDEV =" statements,
but for other statements with arguments, such as "IFS=," "DEVICE=,"
and "SHELL=" statements, for the CONFIG.SYS file.

      The Command Parser uses rules defined by the caller to parse
the command line and to set up an output buffer.  With C language,
the Command Parser interface is defined as follows:

CC FAR Command_Parser(char_far *pCmdLine, POPTIONTABLE pOptTable,
                     unsigned char *pOutBuf, unsigned short
OutBuf_Len);

     On entry:
          pCmdline   = Pointer to CONFIG.SYS command line.
          pOptTable  = Pointer to caller defined parsing rules.
          pOutBuf    = Pointer to caller supplied output buffer.
          OutBuf_Len = Size of output buffer (pOutBuf).

     On exit:
          CC.ret_code  = Pre-defined return code.
          CC.err_index = Command line (pCmdLine) index of the
character
                         in error.
          pOutBuf      = The output buffer, contains the parsed
command
                         line options, in the format shown in Fig. 2.

      The Option Table enables the caller to define the parsing
rules.  The structure of the Option Table is defined as follows:

     typedef struct _optiontable
     {
       unsigned char     entry_state;
       unsigned char     max_state;
       POPT              poption(n);
     } OPTIONTABLE, FAR *POPTIONTABLE;

The key elements of the OPTIONTABLE structure are:

       entry_state = Defines the entry position into the state table.
       max_state   = Defines the maximum number of elements in the
state
                     table.
       poption(n)  = Contains an array of OPT structure pointers (one
                     per valid command line option.)  Each OPT
structure
                     defines the rules associated with specific
command
                     line optio...