From pa.dec.com!decwrl!uunet!sparky!kent Sun Aug 18 09:20:57 PDT 1991
Article: 2645 of comp.sources.misc
Newsgroups: comp.sources.misc
Path: pa.dec.com!decwrl!uunet!sparky!kent
From: Brad Appleton <brad@hcx1.ssd.csd.harris.com>
Subject:  v22i024:  parseargs - functions to parse command line arguments, Patch08
Message-ID: <1991Aug16.030500.17320@sparky.IMD.Sterling.COM>
X-Md4-Signature: 2c578b5d5f1b1c4ea311d648e10d4381
Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield)
Reply-To: uunet!travis.ssd.csd.harris.com!brad
Organization: Harris Computer Systems
Date: Fri, 16 Aug 1991 03:05:00 GMT
Approved: kent@sparky.imd.sterling.com
Lines: 1983

Submitted-by: Brad Appleton <brad@hcx1.ssd.csd.harris.com>
Posting-number: Volume 22, Issue 24
Archive-name: parseargs/patch08
Environment: UNIX, VMS, MS-DOS, OS/2, Amiga
Patch-To: parseargs: Volume 17, Issue 46-57

This is patch08 of parseargs. It does not change very much. 90% of the changes
are in the comments. It does fix a few memory leaks in some of the lesser used
functions however. The following is a more detailed description:

    - fixed some typos in the comments (SIDE-EFFECTS was misspelled
      everywhere in the comments for the functions).
    - fixed up external definition of ProgName to work for C++
      (added extern "C").
    - fixed up lparseargs() and vparseargs to free the argument vector
      when it was finished with it.
    - added some more comments to xparse.c and parseargs.c.

TO APPLY THIS PATCH:
   1) cd to your parseargs source directory
   2) unshar this file to get the file PATCH08
   3) type "patch -p0 <PATCH08"

Enjoy!
 _____________________ "And miles to go before I sleep." ______________________
 Brad Appleton                         Harris Corp., Computer Systems Division
   Software Engineer                   2101 West Cypress Creek Road,  M/S 161 
     brad@ssd.csd.harris.com           Fort Lauderdale, FL  33309-1892  USA
       ...!uunet!travis!brad                 Phone: (305) 973-5190
 ~~~~~~~~~~~~~~~~~~~ Disclaimer: I said it, not my company! ~~~~~~~~~~~~~~~~~~~

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  PATCH08
# Wrapped by brad@hcx2 on Thu Aug 15 11:55:16 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'PATCH08' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'PATCH08'\"
else
echo shar: Extracting \"'PATCH08'\" \(54518 characters\)
sed "s/^X//" >'PATCH08' <<'END_OF_FILE'
X*** Intro.OLD	Thu Aug 15 11:46:15 1991
X--- Intro	Thu Aug 15 11:05:23 1991
X***************
X*** 98,104 ****
X  
X   The VMS command-line syntax would be the following:
X  
X!     cmdname [/AREA[=<areacode>]] [/GROUPS=<newsgroups>[,<newsgroups>...]
X              [/REP=<repcount>] [/SEP=<sepchar>] [/X]  <name>
X              [<args>[,<args>...]]
X  
X--- 98,104 ----
X  
X   The VMS command-line syntax would be the following:
X  
X!     cmdname [/AREA[=<areacode>]] [/GROUPS=<newsgroups>[,<newsgroups>...]]
X              [/REP=<repcount>] [/SEP=<sepchar>] [/X]  <name>
X              [<args>[,<args>...]]
X  
X*** README.OLD	Thu Aug 15 11:46:40 1991
X--- README	Thu Aug 15 11:06:56 1991
X***************
X*** 222,229 ****
X  
X  
X               Update to parseargs (and major re-write) by Brad Appleton
X!                         (brad@travis.ssd.csd.harris.com)
X!                               Last Update: 04/12/91
X   
X  
X   THIS RELEASE
X--- 222,229 ----
X  
X  
X               Update to parseargs (and major re-write) by Brad Appleton
X!                         (brad@ssd.csd.harris.com)
X!                               Last Update: 08/15/91
X   
X  
X   THIS RELEASE
X*** amiga_args.c.OLD	Thu Aug 15 11:46:47 1991
X--- amiga_args.c	Thu Aug  1 15:45:49 1991
X***************
X*** 69,75 ****
X  ** ^REQUIREMENTS:
X  **    The final element in argv must be a NULL pointer.
X  **
X! ** ^SIDE-EFECTS:
X  **    argd is modified according to the command-line description and parameters
X  **
X  ** ^RETURN-VALUE:
X--- 69,75 ----
X  ** ^REQUIREMENTS:
X  **    The final element in argv must be a NULL pointer.
X  **
X! ** ^SIDE-EFFECTS:
X  **    argd is modified according to the command-line description and parameters
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 347,353 ****
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X--- 347,353 ----
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 415,421 ****
X  ** ^REQUIREMENTS:
X  **    argd should be a non-null command-line argument-descriptor array
X  **
X! ** ^SIDE-EFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X--- 415,421 ----
X  ** ^REQUIREMENTS:
X  **    argd should be a non-null command-line argument-descriptor array
X  **
X! ** ^SIDE-EFFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X*** arglist.c.OLD	Thu Aug 15 11:46:54 1991
X--- arglist.c	Thu Aug  1 15:45:54 1991
X***************
X*** 61,67 ****
X  **    string-list argument. The ad_valp field of ad MUST be either NULL or
X  **    point to a valid arglist-head structure.
X  **
X! ** ^SIDE-EFECTS:
X  **    If successful, arglist pointed to by arg_valp(ad) is appended with
X  **    the given string, <vp> is unchanged.
X  **
X--- 61,67 ----
X  **    string-list argument. The ad_valp field of ad MUST be either NULL or
X  **    point to a valid arglist-head structure.
X  **
X! ** ^SIDE-EFFECTS:
X  **    If successful, arglist pointed to by arg_valp(ad) is appended with
X  **    the given string, <vp> is unchanged.
X  **
X***************
X*** 174,180 ****
X  ** ^REQUIREMENTS:
X  **    argls must point to a valid arglist-head structure.
X  **
X! ** ^SIDE-EFECTS:
X  **    each item in argls is removed, argls itself should be set to NULL
X  **    after this routine is invoked.
X  **
X--- 174,180 ----
X  ** ^REQUIREMENTS:
X  **    argls must point to a valid arglist-head structure.
X  **
X! ** ^SIDE-EFFECTS:
X  **    each item in argls is removed, argls itself should be set to NULL
X  **    after this routine is invoked.
X  **
X*** ibm_args.c.OLD	Thu Aug 15 11:50:11 1991
X--- ibm_args.c	Thu Aug  1 15:46:01 1991
X***************
X*** 97,103 ****
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFECTS:
X  **    Sets the global variables "OptPrefix" and "KwdPrefix'.
X  **
X  ** ^RETURN-VALUE:
X--- 97,103 ----
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Sets the global variables "OptPrefix" and "KwdPrefix'.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 162,168 ****
X  ** ^REQUIREMENTS:
X  **    The final element in argv must be a NULL pointer.
X  **
X! ** ^SIDE-EFECTS:
X  **    argd is modified according to the command-line description and parameters
X  **
X  ** ^RETURN-VALUE:
X--- 162,168 ----
X  ** ^REQUIREMENTS:
X  **    The final element in argv must be a NULL pointer.
X  **
X! ** ^SIDE-EFFECTS:
X  **    argd is modified according to the command-line description and parameters
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 564,570 ****
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X--- 564,570 ----
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 658,664 ****
X  ** ^REQUIREMENTS:
X  **    argd should be a non-null command-line argument-descriptor array
X  **
X! ** ^SIDE-EFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X--- 658,664 ----
X  ** ^REQUIREMENTS:
X  **    argd should be a non-null command-line argument-descriptor array
X  **
X! ** ^SIDE-EFFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X*** parseargs.c.OLD	Thu Aug 15 11:50:26 1991
X--- parseargs.c	Thu Aug 15 10:56:52 1991
X***************
X*** 244,256 ****
X     /* array of shell info records for supported shells */
X  static CONST shell_info  Shell[] = {
X     {
X        SH,  "sh",
X!       "shift $#;\n",  
X        "%s=",  "'",  "';\n",
X        "%s=",  "'",  "'%s'",  "';\n",
X!       "'\\%c'",  "'"
X     },
X     {
X        BASH,  "bash",
X        "shift $#;\n",  
X        "%s=",  "'",  "';\n",
X--- 244,270 ----
X     /* array of shell info records for supported shells */
X  static CONST shell_info  Shell[] = {
X     {
X+          /* Bourne Shell */
X        SH,  "sh",
X! 
X!          /* "shift $#" unsets the positional parameters */
X!       "shift $#;\n",
X! 
X!          /* "name='value'" assigns "value" to the variable "name" */
X        "%s=",  "'",  "';\n",
X+ 
X+          /* "ary='elt1 elt2 ...'" assigns an array named "ary" */
X        "%s=",  "'",  "'%s'",  "';\n",
X! 
X!          /* the only character we need to escape is a "'", We do this by ending
X!          ** the current quote, escaping the quote, and starting a new one
X!          */
X!       "'\\%c'",  "'"                    
X     },
X     {
X+          /* Bourne-Again shell -- we treat it the same as the Bourne shell.
X+          ** (this should change when BASH supports arrays)
X+          */
X        BASH,  "bash",
X        "shift $#;\n",  
X        "%s=",  "'",  "';\n",
X***************
X*** 258,298 ****
X--- 272,380 ----
X        "'\\%c'",  "'"
X     },
X     {
X+          /* Korn Shell */
X        KSH,  "ksh",
X+ 
X+          /* "set -- ;" unsets the positional parameters */
X        "set --;\n",  
X+ 
X+          /* "name='value'" assigns "value" to the variable "name" */
X        "%s=",  "'",  "';\n",
X+ 
X+          /* "set [-+]A ary 'elt1' 'elt2' ..." assigns an array named "ary" */
X        "set %cA %s ",  "'",  "'%s'",  "';\n",
X+ 
X+          /* the only character we need to escape is a "'", We do this by ending
X+          ** the current quote, escaping the quote, and starting a new one
X+          */
X        "'\\%c'",  "'"
X     },
X     {
X+          /* C-Shell */
X        CSH,  "csh",
X+ 
X+          /* "set argv=()" unsets the positional parameters */
X        "set argv=();\n",  
X+ 
X+          /* "set name='value'" assigns "value" to the variable "name" */
X        "set %s=",  "'",  "';\n",
X+ 
X+          /* "set ary=( 'elt1' 'elt2' ... )" assigns an array named "ary" */
X        "set %s=",  "( '",  "'%s'",  "' );\n",
X+ 
X+          /* the only character we need to escape is a "'", We do this by ending
X+          ** the current quote, escaping the quote, and starting a new one
X+          */
X        "'\\%c'",  "'"
X     },
X     {
X+          /* Z-Shell -- this is a lot like the C-Shell except we dont need
X+          ** the 'set' keyword when assigning variables and arrays
X+          */
X        ZSH,  "zsh",
X+ 
X+          /* "argv=()" unsets the positional parameters */
X        "argv=();\n",  
X+ 
X+          /* "name='value'" assigns "value" to the variable "name" */
X        "%s=",  "'",  "';\n",
X+ 
X+          /* "ary=( 'elt1' 'elt2' ... )" assigns an array named "ary" */
X        "%s=",  "( '",  "'%s'",  "' );\n",
X+ 
X+          /* the only character we need to escape is a "'", We do this by ending
X+          ** the current quote, escaping the quote, and starting a new one
X+          */
X        "'\\%c'",  "'"
X     },
X     {
X+          /* rc -- the Plan 9 shell designed by Tom Duff */
X        RC,  "rc",
X+ 
X+          /* "*=()" unsets the positional parameters */
X        "*=();\n",  
X+ 
X+          /* "name='value'" assigns "value" to the variable "name" */
X        "%s=",  "'",  "';\n",
X+ 
X+          /* "ary=( 'elt1' 'elt2' ... )" assigns an array named "ary" */
X        "%s=",  "( '",  "'%s'",  "' );\n",
X+ 
X+          /* the only character to escape is a "'", We do this by using
X+          ** two "'" characters in a row.
X+          */
X        "''",  "'"
X     },
X     {
X+          /* perl - Larry Wall's Practical Extraction and Reoprt Language */
X        PERL,  "perl",
X+ 
X+          /* "@ARGV = ()" unsets the positional parameters */
X        "@ARGV = ();\n",  
X+ 
X+          /* "$name = 'value' ;" assigns "value" to the variable "name" */
X        "$%s = ",  "'",  "';\n",
X+ 
X+          /* "@ary = ( 'elt1', 'elt2', ... );" assigns an array named "ary" */
X        "@%s = ",  "( '",  "', '",  "' );\n",
X+ 
X+          /* the only character to escape is a "'", We do this by preceding it
X+          ** with a backslash.
X+          */
X        "\\%c",  "'"
X     },
X     {
X+          /* awk -- Aho, Weinberger, & Kernighan's pattern-action language
X+          **
X+          ** we treat awk differently then the other shells. This is because
X+          ** we cant use actual awk syntax (since awk doesnt have the equivalent
X+          ** of an 'eval' command). Instead, we write out an input stream for
X+          ** consisting or variable assignments. Records are multi-line, and
X+          ** separated by a blank line. Fields are separated by a newline. 
X+          ** The first field is the name of the variable and the remaining
X+          ** fields (if more than one remains we have an array) of the values
X+          ** associated with the variable.
X+          */
X        AWK,  "awk",
X        "ARGV\n\n",  
X        "%s\n",  "",  "\n\n",
X***************
X*** 352,357 ****
X--- 434,445 ----
X  
X  /*************************************************************************/
X  
X+ /*
X+ ** argVers() -- This is the function used to print the version of parseargs
X+ **              on standard output and then exit (regardless of where its
X+ **              corresponding '-#' appears on the command line and regardless
X+ **              of what may have preceded it).
X+ */
X  /*ARGSUSED*/
X  #ifdef __ANSI_C__
X     static BOOL argVers( register ARGDESC *ad,  register char *vp,  BOOL copyf )
X***************
X*** 504,510 ****
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFECTS:
X  **    Storage associated with all dynamically allocated arg-vectors
X  **    is released and set to NULL.
X  **
X--- 592,598 ----
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Storage associated with all dynamically allocated arg-vectors
X  **    is released and set to NULL.
X  **
X***************
X*** 559,565 ****
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFECTS:
X  **    Storage associated with all dynamically allocated global-variables
X  **    is released and set to NULL.
X  **
X--- 647,653 ----
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Storage associated with all dynamically allocated global-variables
X  **    is released and set to NULL.
X  **
X***************
X*** 614,620 ****
X  ** ^REQUIREMENTS:
X  **    size should be > 0
X  **
X! ** ^SIDE-EFECTS:
X  **    Memory is allocated that should later be deallocated using free().
X  **
X  ** ^RETURN-VALUE:
X--- 702,708 ----
X  ** ^REQUIREMENTS:
X  **    size should be > 0
X  **
X! ** ^SIDE-EFFECTS:
X  **    Memory is allocated that should later be deallocated using free().
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 667,673 ****
X  ** ^REQUIREMENTS:
X  **    size should be > 0
X  **
X! ** ^SIDE-EFECTS:
X  **    Memory is allocated that should later be deallocated using free().
X  **
X  ** ^RETURN-VALUE:
X--- 755,761 ----
X  ** ^REQUIREMENTS:
X  **    size should be > 0
X  **
X! ** ^SIDE-EFFECTS:
X  **    Memory is allocated that should later be deallocated using free().
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 721,727 ****
X  **    Both <ch> and <esc> should be non-zero.
X  **    <str> should be non-null and non-empty.
X  **
X! ** ^SIDE-EFECTS:
X  **    Each occurrence in <str> of <ch> within single or double quotes is
X  **    replaced with <esc>.
X  **
X--- 809,815 ----
X  **    Both <ch> and <esc> should be non-zero.
X  **    <str> should be non-null and non-empty.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Each occurrence in <str> of <ch> within single or double quotes is
X  **    replaced with <esc>.
X  **
X***************
X*** 781,787 ****
X  **    It should be noted that escape_char() only replaces characters in quotes
X  **    whereas this routine replaces all occurrences.
X  **
X! ** ^SIDE-EFECTS:
X  **    Each occurrence of <esc> in <str> is replaced with <ch>.
X  **
X  ** ^RETURN-VALUE:
X--- 869,875 ----
X  **    It should be noted that escape_char() only replaces characters in quotes
X  **    whereas this routine replaces all occurrences.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Each occurrence of <esc> in <str> is replaced with <ch>.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 823,829 ****
X  ** ^REQUIREMENTS:
X  **    type_str should be non-NULL and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 911,917 ----
X  ** ^REQUIREMENTS:
X  **    type_str should be non-NULL and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 901,907 ****
X  ** ^REQUIREMENTS:
X  **    flag_str should be non-NULL and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 989,995 ----
X  ** ^REQUIREMENTS:
X  **    flag_str should be non-NULL and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 960,966 ****
X  ** ^REQUIREMENTS:
X  **    Standard input should be open for reading and be non-interactive.
X  **
X! ** ^SIDE-EFECTS:
X  **    Memory is allocated that should later be deallocated using free.
X  **
X  ** ^RETURN-VALUE:
X--- 1048,1054 ----
X  ** ^REQUIREMENTS:
X  **    Standard input should be open for reading and be non-interactive.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Memory is allocated that should later be deallocated using free.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1078,1084 ****
X  ** ^REQUIREMENTS:
X  **    sh_str should be non-NULL and non-empty.
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 1166,1172 ----
X  ** ^REQUIREMENTS:
X  **    sh_str should be non-NULL and non-empty.
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1141,1147 ****
X  ** ^REQUIREMENTS:
X  **    argd_str should be non-NULL and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    The global variables UsrVals and UsrArgd are allocated and initialized
X  **
X  ** ^RETURN-VALUE:
X--- 1229,1235 ----
X  ** ^REQUIREMENTS:
X  **    argd_str should be non-NULL and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    The global variables UsrVals and UsrArgd are allocated and initialized
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1357,1363 ****
X  **    <fp> should be non-NULL and open for writing.
X  **    <ch> should be a printable character.
X  **
X! ** ^SIDE-EFECTS:
X  **    output is written to <fp>.
X  **
X  ** ^RETURN-VALUE:
X--- 1445,1451 ----
X  **    <fp> should be non-NULL and open for writing.
X  **    <ch> should be a printable character.
X  **
X! ** ^SIDE-EFFECTS:
X  **    output is written to <fp>.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1416,1422 ****
X  **    <fp> should be non-NULL and open for writing.
X  **    <str> should be non-NULL and non-empty.
X  **
X! ** ^SIDE-EFECTS:
X  **    Output is written to <fp>
X  **
X  ** ^RETURN-VALUE:
X--- 1504,1510 ----
X  **    <fp> should be non-NULL and open for writing.
X  **    <str> should be non-NULL and non-empty.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Output is written to <fp>
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1470,1476 ****
X  ** ^REQUIREMENTS:
X  **    <val> should be the value corresponing to the argument-descriptor <ad>
X  **
X! ** ^SIDE-EFECTS:
X  **    Output is written to <fp>.
X  **
X  ** ^RETURN-VALUE:
X--- 1558,1564 ----
X  ** ^REQUIREMENTS:
X  **    <val> should be the value corresponing to the argument-descriptor <ad>
X  **
X! ** ^SIDE-EFFECTS:
X  **    Output is written to <fp>.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1732,1738 ****
X  ** ^REQUIREMENTS:
X  **    <val> should correspond to the vlue of the argument indicated by <ad>
X  **
X! ** ^SIDE-EFECTS:
X  **    prints the array assignment statement on standard output
X  **
X  ** ^RETURN-VALUE:
X--- 1820,1826 ----
X  ** ^REQUIREMENTS:
X  **    <val> should correspond to the vlue of the argument indicated by <ad>
X  **
X! ** ^SIDE-EFFECTS:
X  **    prints the array assignment statement on standard output
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1825,1831 ****
X  **    The argument values have already been set due to the fact that parseargs
X  **    should already have been invoked to parse the command-line
X  **
X! ** ^SIDE-EFECTS:
X  **    Variable assignment statements are printed on standard output.
X  **
X  ** ^RETURN-VALUE:
X--- 1913,1919 ----
X  **    The argument values have already been set due to the fact that parseargs
X  **    should already have been invoked to parse the command-line
X  **
X! ** ^SIDE-EFFECTS:
X  **    Variable assignment statements are printed on standard output.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1926,1932 ****
X  ** ^REQUIREMENTS:
X  **    The currenty shell-type has already been determined.
X  **
X! ** ^SIDE-EFECTS:
X  **    Prints on stdout.
X  **
X  ** ^RETURN-VALUE:
X--- 2014,2020 ----
X  ** ^REQUIREMENTS:
X  **    The currenty shell-type has already been determined.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Prints on stdout.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1962,1968 ****
X  ** ^REQUIREMENTS:
X  **    The command-line should already have been parsed by parseargs(3)
X  **
X! ** ^SIDE-EFECTS:
X  **    - Exits the program if an error is encountered.
X  **    - Assigns any needed defaults for StrTrue and StrFalse.
X  **    - Gets the argd-string from an environment variable if needed
X--- 2050,2056 ----
X  ** ^REQUIREMENTS:
X  **    The command-line should already have been parsed by parseargs(3)
X  **
X! ** ^SIDE-EFFECTS:
X  **    - Exits the program if an error is encountered.
X  **    - Assigns any needed defaults for StrTrue and StrFalse.
X  **    - Gets the argd-string from an environment variable if needed
X*** parseargs.h.OLD	Thu Aug 15 11:50:41 1991
X--- parseargs.h	Thu Aug  1 15:47:32 1991
X***************
X*** 1011,1017 ****
X     EXTERN int   parsecntl   ARGS(( ARGDESC *, parsecntl_t, parsemode_t, ...));
X     EXTERN VOID  usage       ARGS(( const ARGDESC * ));
X     EXTERN VOID  init_args   ARGS(( ARGDESC * ));
X!    extern CONST char *ProgName;
X  #endif  /* PARSEARGS_NEXTERNS */
X  
X  #endif  /* PARSEARGS_H */
X--- 1011,1017 ----
X     EXTERN int   parsecntl   ARGS(( ARGDESC *, parsecntl_t, parsemode_t, ...));
X     EXTERN VOID  usage       ARGS(( const ARGDESC * ));
X     EXTERN VOID  init_args   ARGS(( ARGDESC * ));
X!    EXTERN CONST char *ProgName;
X  #endif  /* PARSEARGS_NEXTERNS */
X  
X  #endif  /* PARSEARGS_H */
X*** patchlevel.h.OLD	Thu Aug 15 11:50:53 1991
X--- patchlevel.h	Thu Aug 15 10:57:37 1991
X***************
X*** 2,7 ****
X--- 2,17 ----
X  ** ^FILE: patchlevel.h - current patchlevel for parseargs
X  **
X  ** ^HISTORY:
X+ **    08/15/91	Brad Appleton	<brad@ssd.csd.harris.com>
X+ **    Patch08
X+ **    - fixed some typos in the comments (SIDE-EFFECTS was misspelled
X+ **      everywhere in the comments for the functions).
X+ **    - fixed up external definition of ProgName to work for C++
X+ **      (added extern "C").
X+ **    - fixed up lparseargs() and vparseargs to free the argument vector
X+ **      when it was finished with it.
X+ **    - added some more comments to xparse.c and parseargs.c.
X+ **
X  **    06/05/91	Brad Appleton	<brad@ssd.csd.harris.com>
X  **    Patch07
X  **    - fixed the "Intro" file to correctly show how to invoke parseargs(3)
X***************
X*** 91,97 ****
X  
X  #define  VERSION     2
X  #define  REVISION    0
X! #define  PATCHLEVEL  7
X  
X  #ifdef __STDC__
X     static const char
X--- 101,107 ----
X  
X  #define  VERSION     2
X  #define  REVISION    0
X! #define  PATCHLEVEL  8
X  
X  #ifdef __STDC__
X     static const char
X***************
X*** 98,101 ****
X  #else
X     static char
X  #endif
X!    _Ident[] = "@(#)parseargs  2.0  patchlevel 7";
X--- 108,111 ----
X  #else
X     static char
X  #endif
X!    _Ident[] = "@(#)parseargs  2.0  patchlevel 8";
X*** pgopen.c.OLD	Thu Aug 15 11:50:58 1991
X--- pgopen.c	Thu Aug  1 15:46:13 1991
X***************
X*** 104,110 ****
X  **    pgopen() must first be called in order to obtain a valid
X  **    pager-file-pointer.
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 104,110 ----
X  **    pgopen() must first be called in order to obtain a valid
X  **    pager-file-pointer.
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 143,149 ****
X  **    pgopen() must first be called in order to obtain a valid
X  **    pager-file-pointer.
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 143,149 ----
X  **    pgopen() must first be called in order to obtain a valid
X  **    pager-file-pointer.
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 213,219 ****
X  **    program which reads from standard input and writes (one screenful
X  **    at a time) to the terminal.
X  **
X! ** ^SIDE-EFECTS:
X  **    If popen() succeeds, the SIGPIPE signal is trapped.
X  **
X  ** ^RETURN-VALUE:
X--- 213,219 ----
X  **    program which reads from standard input and writes (one screenful
X  **    at a time) to the terminal.
X  **
X! ** ^SIDE-EFFECTS:
X  **    If popen() succeeds, the SIGPIPE signal is trapped.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 346,352 ****
X  **    Pgopen must place the address of the desired recovery point in
X  **    pg_recover.
X  **
X! ** ^SIDE-EFECTS:
X  **    Resets SIGPIPE signal-handler and performs a non-local goto.
X  **
X  ** ^RETURN-VALUE:
X--- 346,352 ----
X  **    Pgopen must place the address of the desired recovery point in
X  **    pg_recover.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Resets SIGPIPE signal-handler and performs a non-local goto.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 387,393 ****
X  **    pager_cmd must be non-null and be large enough to hold any of the
X  **    possible pager program-names to be opened.
X  **
X! ** ^SIDE-EFECTS:
X  **    pager_cmd is over-written with the name of the pager-command to
X  **    try to open for output
X  **
X--- 387,393 ----
X  **    pager_cmd must be non-null and be large enough to hold any of the
X  **    possible pager program-names to be opened.
X  **
X! ** ^SIDE-EFFECTS:
X  **    pager_cmd is over-written with the name of the pager-command to
X  **    try to open for output
X  **
X*** stest.c.OLD	Thu Aug 15 11:51:11 1991
X--- stest.c	Thu Aug  1 15:46:18 1991
X***************
X*** 181,187 ****
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFECTS:
X  **    All the static-global argument variables are rewritten.
X  **
X  ** ^RETURN-VALUE:
X--- 181,187 ----
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFFECTS:
X  **    All the static-global argument variables are rewritten.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 233,239 ****
X  **    The command-line should have already been parsed by one of the
X  **    Xparseargs functions.
X  **
X! ** ^SIDE-EFECTS:
X  **    Prints on stdout.
X  **
X  ** ^RETURN-VALUE:
X--- 233,239 ----
X  **    The command-line should have already been parsed by one of the
X  **    Xparseargs functions.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Prints on stdout.
X  **
X  ** ^RETURN-VALUE:
X*** strfuncs.c.OLD	Thu Aug 15 11:51:18 1991
X--- strfuncs.c	Thu Aug  1 15:46:24 1991
X***************
X*** 80,86 ****
X  ** ^REQUIREMENTS:
X  **    Dest must be non-null, and large enough to hold the copied result.
X  **
X! ** ^SIDE-EFECTS:
X  **    Dest is (re)written
X  **
X  ** ^RETURN-VALUE:
X--- 80,86 ----
X  ** ^REQUIREMENTS:
X  **    Dest must be non-null, and large enough to hold the copied result.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Dest is (re)written
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 147,153 ****
X  ** ^REQUIREMENTS:
X  **    str should be non-null and non-empty.
X  **
X! ** ^SIDE-EFECTS:
X  **    str is overwritten with the uppercase (lowercase) result.
X  **
X  ** ^RETURN-VALUE:
X--- 147,153 ----
X  ** ^REQUIREMENTS:
X  **    str should be non-null and non-empty.
X  **
X! ** ^SIDE-EFFECTS:
X  **    str is overwritten with the uppercase (lowercase) result.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 212,218 ****
X  ** ^REQUIREMENTS:
X  **    Both s1 and s2 should be non-null and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 212,218 ----
X  ** ^REQUIREMENTS:
X  **    Both s1 and s2 should be non-null and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 344,350 ****
X  ** ^REQUIREMENTS:
X  **    Both str1 and str2 should be non-null and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 344,350 ----
X  ** ^REQUIREMENTS:
X  **    Both str1 and str2 should be non-null and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 394,400 ****
X  ** ^REQUIREMENTS:
X  **    Both str1 and str2 should be non-null and non-empty.
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 394,400 ----
X  ** ^REQUIREMENTS:
X  **    Both str1 and str2 should be non-null and non-empty.
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 477,483 ****
X  ** ^REQUIREMENTS:
X  **    str should be non-null and non-empty.
X  **
X! ** ^SIDE-EFECTS:
X  **    characters may be removed from the beginning and/or end of str.
X  **
X  ** ^RETURN-VALUE:
X--- 477,483 ----
X  ** ^REQUIREMENTS:
X  **    str should be non-null and non-empty.
X  **
X! ** ^SIDE-EFFECTS:
X  **    characters may be removed from the beginning and/or end of str.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 584,590 ****
X  **    vec must be non-NULL (it must be a valid address).
X  **    token_str should be non-null and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    All leading and trailing characters from <separators> are removed
X  **    from token_str. Furthermore, all remaining sequences in token_str
X  **    of characters from <separators> are replaced with a single NUL-byte.
X--- 584,590 ----
X  **    vec must be non-NULL (it must be a valid address).
X  **    token_str should be non-null and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    All leading and trailing characters from <separators> are removed
X  **    from token_str. Furthermore, all remaining sequences in token_str
X  **    of characters from <separators> are replaced with a single NUL-byte.
X***************
X*** 693,699 ****
X  **    argv must be non-NULL (it must be a valid address), and must be
X  **    terminated by a pointer to NULL (argv[last+1] == NULL).
X  **
X! ** ^SIDE-EFECTS:
X  **    Storage is allocated.
X  **
X  ** ^RETURN-VALUE:
X--- 693,699 ----
X  **    argv must be non-NULL (it must be a valid address), and must be
X  **    terminated by a pointer to NULL (argv[last+1] == NULL).
X  **
X! ** ^SIDE-EFFECTS:
X  **    Storage is allocated.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 773,779 ****
X  **    Both s and buf must be non-null and non-empty.
X  **    buf must be large enough to hold the result.
X  **
X! ** ^SIDE-EFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X--- 773,779 ----
X  **    Both s and buf must be non-null and non-empty.
X  **    buf must be large enough to hold the result.
X  **
X! ** ^SIDE-EFFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 834,840 ****
X  **    Both s and buf must be non-null and non-empty.
X  **    buf must be large enough to hold the result.
X  **
X! ** ^SIDE-EFECTS:
X  **    buf is overwritten.
X  *
X  ** ^RETURN-VALUE:
X--- 834,840 ----
X  **    Both s and buf must be non-null and non-empty.
X  **    buf must be large enough to hold the result.
X  **
X! ** ^SIDE-EFFECTS:
X  **    buf is overwritten.
X  *
X  ** ^RETURN-VALUE:
X***************
X*** 915,921 ****
X  **    Both candidate and target should be non-null and non-empty.
X  **    target should be the ad_prompt field of an ARGDESC structure.
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 915,921 ----
X  **    Both candidate and target should be non-null and non-empty.
X  **    target should be the ad_prompt field of an ARGDESC structure.
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1035,1041 ****
X  **    path should be non-null, non-empty, and should correspond to a valid
X  **    pathname (absolute or relative).
X  **
X! ** ^SIDE-EFECTS:
X  **    None under Unix and AmigaDOS.
X  **
X  **    Under VMS, the file version is removed and any .COM or .EXE extension
X--- 1035,1041 ----
X  **    path should be non-null, non-empty, and should correspond to a valid
X  **    pathname (absolute or relative).
X  **
X! ** ^SIDE-EFFECTS:
X  **    None under Unix and AmigaDOS.
X  **
X  **    Under VMS, the file version is removed and any .COM or .EXE extension
X***************
X*** 1180,1186 ****
X  ** ^REQUIREMENTS:
X  **    maxcols and indent must be positive numbers with maxcols > indent
X  **
X! ** ^SIDE-EFECTS:
X  **    Output is printed to fp.
X  **
X  ** ^RETURN-VALUE:
X--- 1180,1186 ----
X  ** ^REQUIREMENTS:
X  **    maxcols and indent must be positive numbers with maxcols > indent
X  **
X! ** ^SIDE-EFFECTS:
X  **    Output is printed to fp.
X  **
X  ** ^RETURN-VALUE:
X*** syserr.c.OLD	Thu Aug 15 11:51:32 1991
X--- syserr.c	Thu Aug  1 15:46:29 1991
X***************
X*** 57,63 ****
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFECTS:
X  **    Writes to stderr.
X  **
X  ** ^RETURN-VALUE:
X--- 57,63 ----
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Writes to stderr.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 115,121 ****
X  ** ^REQUIREMENTS:
X  **    No special requirements.
X  **
X! ** ^SIDE-EFECTS:
X  **    All output is written to stderr. Program execution is terminated.
X  **
X  ** ^RETURN-VALUE:
X--- 115,121 ----
X  ** ^REQUIREMENTS:
X  **    No special requirements.
X  **
X! ** ^SIDE-EFFECTS:
X  **    All output is written to stderr. Program execution is terminated.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 173,179 ****
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFECTS:
X  **    Writes to stderr.
X  **
X  ** ^RETURN-VALUE:
X--- 173,179 ----
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Writes to stderr.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 224,230 ****
X  ** ^REQUIREMENTS:
X  **    No special requirements.
X  **
X! ** ^SIDE-EFECTS:
X  **    All output is written to stderr.  Errno is cleared.
X  **
X  ** ^RETURN-VALUE:
X--- 224,230 ----
X  ** ^REQUIREMENTS:
X  **    No special requirements.
X  **
X! ** ^SIDE-EFFECTS:
X  **    All output is written to stderr.  Errno is cleared.
X  **
X  ** ^RETURN-VALUE:
X*** test.rc.OLD	Thu Aug 15 11:51:57 1991
X--- test.rc	Thu Aug 15 11:01:23 1991
X***************
X*** 1,6 ****
X--- 1,10 ----
X  #!/bin/rc
X  #	test.rc - rc shell script to test out the parseargs command!
X  #
X+ #   NOTE: This script tests Byron Rakitzis' version of rc. NOT the
X+ #         Plan 9 version (there are a few differences such as the use
X+ #         of "else" instead of "if not" and the use of "$^variable").
X+ #
X  NAME=`{basename $0}
X  
X  ARGUMENTS='
X*** unix_args.c.OLD	Thu Aug 15 11:52:16 1991
X--- unix_args.c	Thu Aug  1 15:46:35 1991
X***************
X*** 86,92 ****
X  ** ^REQUIREMENTS:
X  **    The final element in argv must be a NULL pointer.
X  **
X! ** ^SIDE-EFECTS:
X  **    argd is modified according to the command-line description and parameters
X  **
X  ** ^RETURN-VALUE:
X--- 86,92 ----
X  ** ^REQUIREMENTS:
X  **    The final element in argv must be a NULL pointer.
X  **
X! ** ^SIDE-EFFECTS:
X  **    argd is modified according to the command-line description and parameters
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 484,490 ****
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X--- 484,490 ----
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 574,580 ****
X  ** ^REQUIREMENTS:
X  **    argd should be a non-null command-line argument-descriptor array
X  **
X! ** ^SIDE-EFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X--- 574,580 ----
X  ** ^REQUIREMENTS:
X  **    argd should be a non-null command-line argument-descriptor array
X  **
X! ** ^SIDE-EFFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X*** unix_man.c.OLD	Thu Aug 15 11:52:23 1991
X--- unix_man.c	Thu Aug  1 15:46:44 1991
X***************
X*** 56,62 ****
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X--- 56,62 ----
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 144,150 ****
X  ** ^REQUIREMENTS:
X  **    Argd should be a valid command-line descriptor array.
X  **
X! ** ^SIDE-EFECTS:
X  **    Prints on standard-output.
X  **
X  ** ^RETURN-VALUE:
X--- 144,150 ----
X  ** ^REQUIREMENTS:
X  **    Argd should be a valid command-line descriptor array.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Prints on standard-output.
X  **
X  ** ^RETURN-VALUE:
X*** vms_args.c.OLD	Thu Aug 15 11:52:36 1991
X--- vms_args.c	Thu Aug  1 15:47:00 1991
X***************
X*** 101,107 ****
X  ** ^REQUIREMENTS:
X  **    argv must be non-null
X  **
X! ** ^SIDE-EFECTS:
X  **    *result is assigned to either the concatenated argv string or the
X  **    original command-line. The result shoub be freed using free().
X  **
X--- 101,107 ----
X  ** ^REQUIREMENTS:
X  **    argv must be non-null
X  **
X! ** ^SIDE-EFFECTS:
X  **    *result is assigned to either the concatenated argv string or the
X  **    original command-line. The result shoub be freed using free().
X  **
X***************
X*** 193,199 ****
X  ** ^REQUIREMENTS:
X  **    <str> should be non-null and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    <str> is "trimmed" to canonical form and special characters are mapped
X  **    to a unique code.
X  **
X--- 193,199 ----
X  ** ^REQUIREMENTS:
X  **    <str> should be non-null and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    <str> is "trimmed" to canonical form and special characters are mapped
X  **    to a unique code.
X  **
X***************
X*** 473,479 ****
X  **    <vp> must already be preprocessed by dcl_strxlat to escape any quoted
X  **    characters and to map special characters to their corresponding values.
X  **
X! ** ^SIDE-EFECTS:
X  **    Ad has some of its flags modified as well as any modifications that
X  **    are made by the ad_type function.
X  **
X--- 473,479 ----
X  **    <vp> must already be preprocessed by dcl_strxlat to escape any quoted
X  **    characters and to map special characters to their corresponding values.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Ad has some of its flags modified as well as any modifications that
X  **    are made by the ad_type function.
X  **
X***************
X*** 551,557 ****
X  ** ^REQUIREMENTS:
X  **    The final element in argv must be a NULL pointer.
X  **
X! ** ^SIDE-EFECTS:
X  **    argd is modified according to the command-line description and parameters
X  **
X  ** ^RETURN-VALUE:
X--- 551,557 ----
X  ** ^REQUIREMENTS:
X  **    The final element in argv must be a NULL pointer.
X  **
X! ** ^SIDE-EFFECTS:
X  **    argd is modified according to the command-line description and parameters
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 830,836 ****
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X--- 830,836 ----
X  **    buf must be large enough to hold the formatted result (100 characters
X  **    should do the trick).
X  **
X! ** ^SIDE-EFFECTS:
X  **    buf is overwritten.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 900,906 ****
X  ** ^REQUIREMENTS:
X  **    argd should be a non-null command-line argument-descriptor array
X  **
X! ** ^SIDE-EFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X--- 900,906 ----
X  ** ^REQUIREMENTS:
X  **    argd should be a non-null command-line argument-descriptor array
X  **
X! ** ^SIDE-EFFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X*** xparse.c.OLD	Thu Aug 15 11:52:58 1991
X--- xparse.c	Thu Aug 15 11:20:40 1991
X***************
X*** 224,236 ****
X  
X  #ifdef vms_style
X  # ifdef vms
X!    { '<', ARGHIDDEN, argInput, __ &stdin,   "INPUT (redirect SYS$INPUT)" },
X!    { '>', ARGHIDDEN, argOutput, __ &stdout, "OUTPUT (redirect SYS$OUTPUT)" },
X!    { '%', ARGHIDDEN, argOutput, __ &stderr, "ERROR (redirect SYS$ERROR)" },
X  # else
X!    { '<', ARGHIDDEN, argInput, __ stdin,   "INPUT (redirect SYS$INPUT)" },
X!    { '>', ARGHIDDEN, argOutput, __ stdout, "OUTPUT (redirect SYS$OUTPUT)" },
X!    { '%', ARGHIDDEN, argOutput, __ stderr, "ERROR (redirect SYS$ERROR)" },
X  # endif
X  #endif
X  
X--- 224,236 ----
X  
X  #ifdef vms_style
X  # ifdef vms
X!    { '<', ARGHIDDEN, argInput, __ &stdin,   "sysINPUT (redirect SYS$INPUT)" },
X!    { '>', ARGHIDDEN, argOutput, __ &stdout, "sysOUTPUT (redirect SYS$OUTPUT)" },
X!    { '%', ARGHIDDEN, argOutput, __ &stderr, "sysERROR (redirect SYS$ERROR)" },
X  # else
X!    { '<', ARGHIDDEN, argInput, __ stdin,   "sysINPUT (redirect SYS$INPUT)" },
X!    { '>', ARGHIDDEN, argOutput, __ stdout, "sysOUTPUT (redirect SYS$OUTPUT)" },
X!    { '%', ARGHIDDEN, argOutput, __ stderr, "sysERROR (redirect SYS$ERROR)" },
X  # endif
X  #endif
X  
X***************
X*** 283,289 ****
X     ** ^REQUIREMENTS:
X     **    sym_name should correspond to the name of a pre-defined symbol.
X     **
X!    ** ^SIDE-EFECTS:
X     **    None.
X     **
X     ** ^RETURN-VALUE:
X--- 283,289 ----
X     ** ^REQUIREMENTS:
X     **    sym_name should correspond to the name of a pre-defined symbol.
X     **
X!    ** ^SIDE-EFFECTS:
X     **    None.
X     **
X     ** ^RETURN-VALUE:
X***************
X*** 344,350 ****
X  ** ^REQUIREMENTS:
X  **    Fd must correspond to a valid, open, file-descriptor.
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 344,350 ----
X  ** ^REQUIREMENTS:
X  **    Fd must correspond to a valid, open, file-descriptor.
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 413,419 ****
X  ** ^REQUIREMENTS:
X  **    str should be non-null and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    The characters which separated the two portions of <str> are
X  **    replaced with a single '\0'.
X  **
X--- 413,419 ----
X  ** ^REQUIREMENTS:
X  **    str should be non-null and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    The characters which separated the two portions of <str> are
X  **    replaced with a single '\0'.
X  **
X***************
X*** 497,503 ****
X  **    <argd> must point to an array that has been declared using the CMD_XXXX
X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
X  **
X! ** ^SIDE-EFECTS:
X  **    The argd is initialized for use.
X  **
X  ** ^RETURN-VALUE:
X--- 497,503 ----
X  **    <argd> must point to an array that has been declared using the CMD_XXXX
X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
X  **
X! ** ^SIDE-EFFECTS:
X  **    The argd is initialized for use.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 642,648 ****
X  **    <argd> must point to an array that has been declared using the CMD_XXXX
X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
X  **
X! ** ^SIDE-EFECTS:
X  **    resets the ARG flags of each argument and the command-state of argd.
X  **
X  ** ^RETURN-VALUE:
X--- 642,648 ----
X  **    <argd> must point to an array that has been declared using the CMD_XXXX
X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
X  **
X! ** ^SIDE-EFFECTS:
X  **    resets the ARG flags of each argument and the command-state of argd.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 723,729 ****
X  ** ^REQUIREMENTS:
X  **    Only the first 255 characters of user input is used.
X  **
X! ** ^SIDE-EFECTS:
X  **    Modifies <ad> accordingly.
X  **
X  ** ^RETURN-VALUE:
X--- 723,729 ----
X  ** ^REQUIREMENTS:
X  **    Only the first 255 characters of user input is used.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Modifies <ad> accordingly.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 828,834 ****
X  **    parse_status should be a pointer to the result of a previous call to
X  **    {f,l,s,v,}parseargs.
X  **
X! ** ^SIDE-EFECTS:
X  **    The arg-descs for missing arguments may be modified by prompt_user.
X  **    parse_status will be modified to indicate whether or not a syntax
X  **    error really has occurred (it will be pe_SUCCESS if all is hunky-dory).
X--- 828,834 ----
X  **    parse_status should be a pointer to the result of a previous call to
X  **    {f,l,s,v,}parseargs.
X  **
X! ** ^SIDE-EFFECTS:
X  **    The arg-descs for missing arguments may be modified by prompt_user.
X  **    parse_status will be modified to indicate whether or not a syntax
X  **    error really has occurred (it will be pe_SUCCESS if all is hunky-dory).
X***************
X*** 943,949 ****
X  **    by preceding it with one of '!', '^', or '~'. Tokens must be separated by
X  **    one or more non-alphanumerics (other than '!', '~', and '^').
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 943,949 ----
X  **    by preceding it with one of '!', '^', or '~'. Tokens must be separated by
X  **    one or more non-alphanumerics (other than '!', '~', and '^').
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1088,1094 ****
X  **    <cmd> must point to an array that has been declared using the CMD_XXXX
X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
X  **
X! ** ^SIDE-EFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X--- 1088,1094 ----
X  **    <cmd> must point to an array that has been declared using the CMD_XXXX
X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
X  **
X! ** ^SIDE-EFFECTS:
X  **    None.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1228,1234 ****
X  **    <cmd> must point to an array that has been declared using the CMD_XXXX
X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
X  **
X! ** ^SIDE-EFECTS:
X  **    Modifies the parse-flags of <cmd> is $PARSECNTL is non-null & non-empty.
X  **
X  ** ^RETURN-VALUE:
X--- 1228,1234 ----
X  **    <cmd> must point to an array that has been declared using the CMD_XXXX
X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Modifies the parse-flags of <cmd> is $PARSECNTL is non-null & non-empty.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1339,1345 ****
X  **    <cmd> should be an array of ARGDESCs declared using the CMD_XXXX macros
X  **    or with the ENDOFARGS (and possible STARTOFARGS) macros.
X  **
X! ** ^SIDE-EFECTS:
X  **    Any matched arguments have their ARGDESCs modified accordingly.
X  **    Also, the command-state is changed to reflect the fact that the
X  **    environment variable has been parsed. Also, after parsing the
X--- 1339,1345 ----
X  **    <cmd> should be an array of ARGDESCs declared using the CMD_XXXX macros
X  **    or with the ENDOFARGS (and possible STARTOFARGS) macros.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Any matched arguments have their ARGDESCs modified accordingly.
X  **    Also, the command-state is changed to reflect the fact that the
X  **    environment variable has been parsed. Also, after parsing the
X***************
X*** 1375,1385 ****
X--- 1375,1390 ----
X  
X     if ( !CMD_isINIT(cmd) )  init_args( cmd );
X  
X+       /* if ignoring the <CMD>_ARGS variable then just return */
X     if ( BTEST(cmd_state(cmd), ps_NOCMDENV) )  return;
X  
X+       /* build the name of the environment variable */
X     strucpy( env_name, ProgName );
X     strcat( env_name, ENV_SUFFIX );
X  
X+       /* get the value of the environment variable,
X+       ** split it up into tokens, and parse it.
X+       */
X     env_args = getenv(env_name);
X     if ( env_args ) {
X        char **argv = (char **)NULL;
X***************
X*** 1402,1407 ****
X--- 1407,1413 ----
X        cmd_prev(cmd) = ARGDESCNULL;
X  #endif
X  
X+          /* check for errors */
X        if ( rc  &&  !BTEST(cmd_flags(cmd), pa_IGNORE) ) {
X           eprintf( "%s: syntax-error in %s \"%s\".\n",
X                    ProgName, USER_VARIABLE, env_name );
X***************
X*** 1444,1450 ****
X  **    <argdp> should point to an array of ARGDESCs declared using the CMD_XXXX
X  **    macros or with the ENDOFARGS (and possible STARTOFARGS) macros.
X  **
X! ** ^SIDE-EFECTS:
X  **	  Initialize argd and parses any default arguments.
X  **
X  ** ^RETURN-VALUE:
X--- 1450,1456 ----
X  **    <argdp> should point to an array of ARGDESCs declared using the CMD_XXXX
X  **    macros or with the ENDOFARGS (and possible STARTOFARGS) macros.
X  **
X! ** ^SIDE-EFFECTS:
X  **	  Initialize argd and parses any default arguments.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1526,1532 ****
X  **    <argd> should be an array of ARGDESCs declared using the CMD_XXXX macros
X  **    or with the ENDOFARGS (and possible STARTOFARGS) macros.
X  **
X! ** ^SIDE-EFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X--- 1532,1538 ----
X  **    <argd> should be an array of ARGDESCs declared using the CMD_XXXX macros
X  **    or with the ENDOFARGS (and possible STARTOFARGS) macros.
X  **
X! ** ^SIDE-EFFECTS:
X  **    Prints on stderr.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1615,1621 ****
X  **    If mode is READ or READ+WRITE then the last argument should be the
X  **    address of the desired object, otherwise it should be the object itself.
X  **
X! ** ^SIDE-EFECTS:
X  **    None if the mode is READ, otherwise, the desired attibutes are (re)set
X  **
X  ** ^RETURN-VALUE:
X--- 1621,1627 ----
X  **    If mode is READ or READ+WRITE then the last argument should be the
X  **    address of the desired object, otherwise it should be the object itself.
X  **
X! ** ^SIDE-EFFECTS:
X  **    None if the mode is READ, otherwise, the desired attibutes are (re)set
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 1690,1696 ****
X  
X        /* now figure out what to do and go do it! */
X     switch( cntl ) {
X!       case  pc_ARGFLAGS :
X           {
X              register ARGDESC *ad, *args;
X              char *name = VA_ARG( ap, char * );
X--- 1696,1702 ----
X  
X        /* now figure out what to do and go do it! */
X     switch( cntl ) {
X!       case  pc_ARGFLAGS :  /* get/set arg-flags */
X           {
X              register ARGDESC *ad, *args;
X              char *name = VA_ARG( ap, char * );
X***************
X*** 1697,1702 ****
X--- 1703,1709 ----
X              int  *argflags;
X              BOOL  is_match = FALSE;
X  
X+                /* first we have to find the argument whose flags we need */
X              for (args = argd ; args  &&  !is_match ; args = cmd_defargs(args)) {
X                 for (ad = ARG_FIRST(args) ; !ARG_isEND(ad) ; ARG_ADVANCE(ad)) {
X                    if ( arg_type(ad) == argDummy )  continue;
X***************
X*** 1713,1718 ****
X--- 1720,1726 ----
X                 return  pe_NOMATCH;
X              }
X  
X+                /* now that we found it - retrieve the argument flags */
X              if ( isREADING(mode) ) {
X                argflags = VA_ARG( ap, int * );
X                *argflags = (int) arg_flags(ad);
X***************
X*** 1723,1732 ****
X           }/*block*/
X           break;
X  
X!       case  pc_PARSEFLAGS :
X           {
X              int *pflags, flags;
X  
X              if ( isREADING(mode) ) {
X                pflags = VA_ARG( ap, int * );
X                flags = (int) cmd_flags(cmd);
X--- 1731,1741 ----
X           }/*block*/
X           break;
X  
X!       case  pc_PARSEFLAGS : /* get/set the parse-flags */
X           {
X              int *pflags, flags;
X  
X+                /* get value from call-stack (dependent on the mode) */
X              if ( isREADING(mode) ) {
X                pflags = VA_ARG( ap, int * );
X                flags = (int) cmd_flags(cmd);
X***************
X*** 1736,1750 ****
X                pflags = &flags;
X              }
X  
X              if ( isWRITING(mode) )  cmd_flags(cmd) = (argMask_t) *pflags;
X              if ( isREADING(mode) )  *pflags = flags;
X           }/*block*/
X           break;
X  
X!       case  pc_DEFARGS :
X           {
X              ARGDESC **pdefargd, *defargd;
X  
X              if ( isREADING(mode) ) {
X                 pdefargd = VA_ARG( ap, ARGDESC ** );
X                 defargd = cmd_defargs(cmd);
X--- 1745,1761 ----
X                pflags = &flags;
X              }
X  
X+                /* perform the desired action(s) */
X              if ( isWRITING(mode) )  cmd_flags(cmd) = (argMask_t) *pflags;
X              if ( isREADING(mode) )  *pflags = flags;
X           }/*block*/
X           break;
X  
X!       case  pc_DEFARGS : /* get/set the default arguments */
X           {
X              ARGDESC **pdefargd, *defargd;
X  
X+                /* get value from call-stack (dependent on the mode) */
X              if ( isREADING(mode) ) {
X                 pdefargd = VA_ARG( ap, ARGDESC ** );
X                 defargd = cmd_defargs(cmd);
X***************
X*** 1773,1784 ****
X           }
X           break;
X  
X!       case  pc_NAME :
X!       case  pc_PURPOSE :
X!       case  pc_DESCRIPTION :
X           {
X              CONST char *str, **pstr;
X  
X              if ( isREADING(mode) ) {
X                 pstr = VA_ARG( ap, CONST char ** );
X                 if      ( cntl == pc_NAME )        str = cmd_name(cmd);
X--- 1784,1796 ----
X           }
X           break;
X  
X!       case  pc_NAME :  /* get/set name */
X!       case  pc_PURPOSE :  /* get/set purpose */
X!       case  pc_DESCRIPTION :  /* get/set description */
X           {
X              CONST char *str, **pstr;
X  
X+                /* get value from call-stack (dependent on the mode) */
X              if ( isREADING(mode) ) {
X                 pstr = VA_ARG( ap, CONST char ** );
X                 if      ( cntl == pc_NAME )        str = cmd_name(cmd);
X***************
X*** 1790,1795 ****
X--- 1802,1808 ----
X                 pstr = &str;
X              }
X  
X+                /* perform the desired action(s) */
X              if ( isWRITING(mode) )  {
X                 if      ( cntl == pc_NAME )        cmd_name(cmd) = *pstr;
X                 else if ( cntl == pc_PURPOSE )     cmd_purpose(cmd) = *pstr;
X***************
X*** 1843,1849 ****
X  ** ^REQUIREMENTS:
X  **    <str> should be non-NULL and non-empty
X  **
X! ** ^SIDE-EFECTS:
X  **    <str> is modified by strsplit().
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X--- 1856,1862 ----
X  ** ^REQUIREMENTS:
X  **    <str> should be non-NULL and non-empty
X  **
X! ** ^SIDE-EFFECTS:
X  **    <str> is modified by strsplit().
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X***************
X*** 1937,1943 ****
X  ** ^REQUIREMENTS:
X  **    <fp> should be non-NULL, already opened-for-reading, file-pointer
X  **
X! ** ^SIDE-EFECTS:
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X  ** ^RETURN-VALUE:
X--- 1950,1956 ----
X  ** ^REQUIREMENTS:
X  **    <fp> should be non-NULL, already opened-for-reading, file-pointer
X  **
X! ** ^SIDE-EFFECTS:
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 2069,2075 ****
X  ** ^REQUIREMENTS:
X  **    <argls> should be an ArgList of strings
X  **
X! ** ^SIDE-EFECTS:
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X  ** ^RETURN-VALUE:
X--- 2082,2088 ----
X  ** ^REQUIREMENTS:
X  **    <argls> should be an ArgList of strings
X  **
X! ** ^SIDE-EFFECTS:
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 2118,2126 ****
X--- 2131,2141 ----
X        argv[i] = L_STRING(ls);
X     }
X  
X+       /* parse the list */
X     saveflags = cmd_flags(argd);
X     BSET(cmd_flags(argd), pa_ARGV0);
X     rc = parse_argv_style( argv, parse_init( &argd ) );
X+    free( argv );
X  
X        /* scan for missing required arguments */
X     if ( SYNTAX_ERROR(rc, argd) ) {
X***************
X*** 2174,2180 ****
X  **    the last argument would appear, then the NULL pointer will end the
X  **    the list of arguments and argc is ignored.
X  **    
X! ** ^SIDE-EFECTS:
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X  ** ^RETURN-VALUE:
X--- 2189,2195 ----
X  **    the last argument would appear, then the NULL pointer will end the
X  **    the list of arguments and argc is ignored.
X  **    
X! ** ^SIDE-EFFECTS:
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X  ** ^RETURN-VALUE:
X***************
X*** 2217,2222 ****
X--- 2232,2238 ----
X     if ( !argv )  return  pe_SYSTEM;
X     argv[ argc ] = CHARNULL;
X  
X+       /* assign the string into the array */
X     VA_START(ap, argc);
X     for ( i = 0; i < argc  &&  (arg = VA_ARG(ap, char *)) ; i++ ) {
X        argv[i] = arg;
X***************
X*** 2223,2229 ****
X--- 2239,2247 ----
X     }
X     VA_END(ap);
X  
X+       /* parse the arguments */
X     rc = parse_argv_style( argv, parse_init( &argd ) );
X+    free( argv );
X  
X        /* scan for missing required arguments */
X     if ( SYNTAX_ERROR(rc, argd) ) {
X***************
X*** 2267,2273 ****
X  ** ^REQUIREMENTS:
X  **    <argv> must be non-NULL and have a NULL pointer as its last item.
X  **
X! ** ^SIDE-EFECTS:
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X  ** ^RETURN-VALUE:
X--- 2285,2291 ----
X  ** ^REQUIREMENTS:
X  **    <argv> must be non-NULL and have a NULL pointer as its last item.
X  **
X! ** ^SIDE-EFFECTS:
X  **    <argd> is modified accordingly as arguments are matched.
X  **
X  ** ^RETURN-VALUE:
END_OF_FILE
if test 54518 -ne `wc -c <'PATCH08'`; then
    echo shar: \"'PATCH08'\" unpacked with wrong size!
fi
# end of 'PATCH08'
fi
echo shar: End of shell archive.
exit 0

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.


