v18i103: parseargs - functions to parse command line arguments, Patch04c/4

Brad Appleton brad at hcx1.ssd.csd.harris.com
Fri Apr 26 14:04:09 AEST 1991


Submitted-by: Brad Appleton <brad at hcx1.ssd.csd.harris.com>
Posting-number: Volume 18, Issue 103
Archive-name: parseargs/patch04c
Patch-To: parseargs: Volume 17, Issue 45-57

#!/bin/sh
# This is part 3 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file PATCH continued
#
if test ! -r _shar_seq_.tmp; then
	echo 'Please unpack part 1 first!'
	exit 1
fi
(read Scheck
 if test "$Scheck" != 3; then
	echo Please unpack part "$Scheck" next!
	exit 1
 else
	exit 0
 fi
) < _shar_seq_.tmp || exit 1
echo 'x - continuing file PATCH'
sed 's/^X//' << 'SHAR_EOF' >> 'PATCH' &&
X  positional parameters (even if one begins with '-' or '+')",
***************
*** 392,417 ****
X  
X  
X  /***************************************************************************
! ** ^FUNCTION: cleanup - deallocate all global storage
X  **
X  ** ^SYNOPSIS:
X  */
X  #ifndef __ANSI_C__
!    static  VOID cleanup()
! #endif  /* !__ANSI_C__ */
X  /*
X  ** ^PARAMETERS:
! **    None.
X  **
- ** ^DESCRIPTION:
- **    Cleanup is used to deallocate any global storage. It is called
- **    before exiting.
- **
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X  ** ^SIDE-EFECTS:
! **    Storage associated with all dynamically allocated global-variables
X  **    is released and set to NULL.
X  **
X  ** ^RETURN-VALUE:
--- 430,456 ----
X  
X  
X  /***************************************************************************
! ** ^FUNCTION: free_vectors - deallocate all vectors in an ARGDESC
X  **
X  ** ^SYNOPSIS:
X  */
X  #ifndef __ANSI_C__
!    static  VOID free_vectors( argd )
X  /*
X  ** ^PARAMETERS:
! */
!    ARGDESC argd[];
! #endif  /* !__ANSI_C__ */
! 
! /* ^DESCRIPTION:
! **    Free_vectors will deallocate the storage used for each arg-vector
! **    referenced by argd.
X  **
X  ** ^REQUIREMENTS:
X  **    None.
X  **
X  ** ^SIDE-EFECTS:
! **    Storage associated with all dynamically allocated arg-vectors
X  **    is released and set to NULL.
X  **
X  ** ^RETURN-VALUE:
***************
*** 421,434 ****
X  **    Trivial.
X  ***^^**********************************************************************/
X  #ifdef __ANSI_C__
!    static void cleanup( void )
X  #endif
X  {
X     register ARGDESC *ad;
X     register storage_t val;
!    
!    /* free up any vectors from the command-line */
!    for ( ad = ARG_FIRST(UsrArgd) ; !ARG_isEND(ad) ; ARG_ADVANCE(ad) ) {
X        if ( ! BTEST(arg_flags(ad), ARGVEC) )  continue;
X  
X        val = *((storage_t *) arg_valp(ad));
--- 460,474 ----
X  **    Trivial.
X  ***^^**********************************************************************/
X  #ifdef __ANSI_C__
!    static void free_vectors( ARGDESC argd[] )
X  #endif
X  {
X     register ARGDESC *ad;
X     register storage_t val;
! 
!    if ( !argd  ||  !CMD_isINIT(argd) )  return;
! 
!    for ( ad = ARG_FIRST(argd) ; !ARG_isEND(ad) ; ARG_ADVANCE(ad) ) {
X        if ( ! BTEST(arg_flags(ad), ARGVEC) )  continue;
X  
X        val = *((storage_t *) arg_valp(ad));
***************
*** 442,450 ****
--- 482,527 ----
X        else if ( arg_type(ad) == argDouble )  vecFree( val.Double_vec, double );
X     }
X  
+ }
+ 
+ 
+ /***************************************************************************
+ ** ^FUNCTION: cleanup - deallocate all global storage
+ **
+ ** ^SYNOPSIS:
+ */
+ #ifndef __ANSI_C__
+    static  VOID cleanup()
+ #endif  /* !__ANSI_C__ */
+ /*
+ ** ^PARAMETERS:
+ **    None.
+ **
+ ** ^DESCRIPTION:
+ **    Cleanup is used to deallocate any global storage. It is called
+ **    before exiting.
+ **
+ ** ^REQUIREMENTS:
+ **    None.
+ **
+ ** ^SIDE-EFECTS:
+ **    Storage associated with all dynamically allocated global-variables
+ **    is released and set to NULL.
+ **
+ ** ^RETURN-VALUE:
+ **    None.
+ **
+ ** ^ALGORITHM:
+ **    Trivial.
+ ***^^**********************************************************************/
+ #ifdef __ANSI_C__
+    static void cleanup( void )
+ #endif
+ {
X     /* free up tables */
X     vecFree( UsrArgv, char * );
X     if ( UsrArgd ) {
+       free_vectors( UsrArgd );
X        free( UsrArgd );
X        UsrArgd = ARGDESCNULL;
X     }
***************
*** 851,857 ****
X  #endif
X  {
X     int  isatty  ARGS((int));
!    int  fread   ARGS((char *, int, int, FILE *));
X     FILE *fp;
X     char *buf;
X     register int  nchars = 0;   /* # bytes read */
--- 928,934 ----
X  #endif
X  {
X     int  isatty  ARGS((int));
!    int  fread   ARGS((ARBPTR, size_t, size_t, FILE *));
X     FILE *fp;
X     char *buf;
X     register int  nchars = 0;   /* # bytes read */
***************
*** 1245,1254 ****
X           fprintf( fp, "\\\n" );
X           return;
X        }
-       else if ( UsrSh == PERL ) {
-          fprintf( fp, "\\n" );
-          return;
-       }
X     }/*if newline*/
X  
X     if ( strchr( Shell[ UsrSh ].metachars, ch ) ) {
--- 1322,1327 ----
***************
*** 1372,1385 ****
X        }
X  
X        if ( arg_type(ad) == argStr ) {
-          if ( UsrSh == PERL )  fputc( '\'', fp );
X           put_str_arg( fp, val->value.Str_vec.array[idx] );
-          if ( UsrSh == PERL )  fputc( '\'', fp );
X        }
X        else if ( arg_type(ad) == argChar ) {
-          if ( UsrSh == PERL )  fputc( '\'', fp );
X           put_char_arg( fp, val->value.Char_vec.array[idx] );
-          if ( UsrSh == PERL )  fputc( '\'', fp );
X        }
X        else if ( arg_type(ad) == argDouble ) {
X           fprintf( fp, "%lf", val->value.Double_vec.array[idx] );
--- 1445,1454 ----
***************
*** 1547,1553 ****
X  **
X  ** ^Plan_9_Shell_Argument_Lists:
X  **    For the Plan 9 shell, if the associated variable name is not "*" then
! **    it is considered to be word-list and set using the following syntax:
X  **
X  **         name=( 'arg1'  'arg2'  ... )
X  **
--- 1616,1622 ----
X  **
X  ** ^Plan_9_Shell_Argument_Lists:
X  **    For the Plan 9 shell, if the associated variable name is not "*" then
! **    it is considered to be a word-list and set using the following syntax:
X  **
X  **         name=( 'arg1'  'arg2'  ... )
X  **
***************
*** 1563,1569 ****
X  **
X  **    If the -A option is given, then the associated variable is considered
X  **    the root name of an array. The ouput for the array will consist of two
! **    lines for each item in the list (as in the following expample):
X  **
X  **         name1
X  **         arg1
--- 1632,1638 ----
X  **
X  **    If the -A option is given, then the associated variable is considered
X  **    the root name of an array. The ouput for the array will consist of two
! **    lines for each item in the list (as in the following example):
X  **
X  **         name1
X  **         arg1
***************
*** 1578,1584 ****
X  **    For perl, each argument list is considered an array and is set using
X  **    the following syntax:
X  **
! **         @name=( arg1 , arg2 ,  ... );
X  **
X  ** ^A_Final_Note_on_Argument_Lists:
X  **    The word-lists used by the C shell, the arrays used by the Korn shell,
--- 1647,1653 ----
X  **    For perl, each argument list is considered an array and is set using
X  **    the following syntax:
X  **
! **         @name=( 'arg1' , 'arg2' ,  ... );
X  **
X  ** ^A_Final_Note_on_Argument_Lists:
X  **    The word-lists used by the C shell, the arrays used by the Korn shell,
***************
*** 1678,1688 ****
X        }
X     }/* end-for */
X  
-    if ( val->value.Vector.array ) {
-       free( val->value.Vector.array );
-       val->value.Vector.array = NULL;
-    }
- 
X     if ( UsrSh == CSH  ||  UsrSh == TCSH  || UsrSh == RC  ||  UsrSh == PERL ) {
X       fputc( ')', stdout );
X     }
--- 1747,1752 ----
***************
*** 2057,2064 ****
X        manpage( UsrArgd );
X     }
X     else {   /* parse callers command-line & print variable settings */
!       if ( Prompt )  BSET(flags, pa_PROMPT);
!       if ( Ignore )  BSET(flags, pa_IGNORE);
X        if ( flags )  (VOID) parsecntl( UsrArgd, pc_PARSEFLAGS, pc_WRITE, flags );
X  
X        if ( (rc = parseargs( UsrArgv.array, UsrArgd )) != 0 ) {
--- 2121,2130 ----
X        manpage( UsrArgd );
X     }
X     else {   /* parse callers command-line & print variable settings */
!       if ( Prompt )    BSET(flags, pa_PROMPT);
!       if ( Ignore )    BSET(flags, pa_IGNORE);
!       if ( AnyCase )   BSET(flags, pa_ANYCASE);
!       if ( Flags1st )  BSET(flags, pa_FLAGS1ST);
X        if ( flags )  (VOID) parsecntl( UsrArgd, pc_PARSEFLAGS, pc_WRITE, flags );
X  
X        if ( (rc = parseargs( UsrArgv.array, UsrArgd )) != 0 ) {
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/parseargs.h	Wed Apr 10 09:54:08 1991
--- parseargs.h	Thu Apr 11 11:07:17 1991
***************
*** 280,286 ****
X  #define  arg_sdesc(ad)        ( arg_sname(ad) + strlen(arg_sname(ad)) + 1 )
X  /*    -- return the description of an argument. If a description was supplied,
X  **       the ARGDESCRIBED flag will be set and the description will immediately
! **       follow the NUL byte of the string name.
X  */
X  #define  ARG_isDESCRIBED(ad)  BTEST( arg_flags(ad), ARGDESCRIBED )
X  /*    -- Evaluates to TRUE only if an argument description was provided.
--- 280,286 ----
X  #define  arg_sdesc(ad)        ( arg_sname(ad) + strlen(arg_sname(ad)) + 1 )
X  /*    -- return the description of an argument. If a description was supplied,
X  **       the ARGDESCRIBED flag will be set and the description will immediately
! **       follow the NULL byte of the string name.
X  */
X  #define  ARG_isDESCRIBED(ad)  BTEST( arg_flags(ad), ARGDESCRIBED )
X  /*    -- Evaluates to TRUE only if an argument description was provided.
***************
*** 562,570 ****
X  */
X  #define pa_IGNORE    0x0002
X  /*    -- Ignore any unrecognized or improperly specified command-line arguments
! **       and continue execution of the program. Normally, if an argument is
! **       unmatched (or is improperly specified), a usage message is printed
! **       program execution is terminated.
X  */
X  #define pa_OPTSONLY  0x0004
X  /*    -- Under UNIX, setting this flag will disable the parsing of long-option
--- 562,570 ----
X  */
X  #define pa_IGNORE    0x0002
X  /*    -- Ignore any unrecognized or improperly specified command-line arguments
! **       and continue execution of the program. Normally, if a required
! **       argument is unmatched (or an argument is improperly specified),
! **       a usage message is printed program execution is terminated.
X  */
X  #define pa_OPTSONLY  0x0004
X  /*    -- Under UNIX, setting this flag will disable the parsing of long-option
***************
*** 591,597 ****
X  #define pa_ANYCASE   0x0020
X  /*    -- Setting this flag cause character-case to be ignored when attempting
X  **       to match single-character argument names (i.e. causes "-i" and "-I"
! **       will be considered equivalent).
X  */
X  #define pa_ARGV0     0x0040
X  /*    -- Normally, the parseargs library will assume that the first argument
--- 591,597 ----
X  #define pa_ANYCASE   0x0020
X  /*    -- Setting this flag cause character-case to be ignored when attempting
X  **       to match single-character argument names (i.e. causes "-i" and "-I"
! **       to be considered equivalent).
X  */
X  #define pa_ARGV0     0x0040
X  /*    -- Normally, the parseargs library will assume that the first argument
***************
*** 608,614 ****
X  **
X  **       Keeping this flag on until the final set of arguments is parsed will
X  **       cause parseargs to not check for missing arguments until the last set
! **       of arguments has been parsed (by the final call to *parseargs).
X  */
X  #define pa_CONTINUE  0x0100
X  /*    -- Setting this flag will cause subsequent calls to the parseargs library
--- 608,615 ----
X  **
X  **       Keeping this flag on until the final set of arguments is parsed will
X  **       cause parseargs to not check for missing arguments until the last set
! **       of arguments has been parsed (by the final call to one of the
! **       functions in the parseargs library).
X  */
X  #define pa_CONTINUE  0x0100
X  /*    -- Setting this flag will cause subsequent calls to the parseargs library
***************
*** 763,769 ****
X  ** ^SECTION: PARSE-MODES - modes to get/set command attributes.
X  **    Parsecntl may be used to read current command attributes, write/assign
X  **    new command attributes, or both. The mode argument to parsecntl
! **    determines the which of these three alternatives are desired. If the
X  **    programmer merely wishes to assign new attributes, then invoking
X  **    parsecntl in pc_WRITE mode and passing the new attributes will do the
X  **    job. If the programmer wishes simply to query attributes, then
--- 764,770 ----
X  ** ^SECTION: PARSE-MODES - modes to get/set command attributes.
X  **    Parsecntl may be used to read current command attributes, write/assign
X  **    new command attributes, or both. The mode argument to parsecntl
! **    determines which of these three alternatives are desired. If the
X  **    programmer merely wishes to assign new attributes, then invoking
X  **    parsecntl in pc_WRITE mode and passing the new attributes will do the
X  **    job. If the programmer wishes simply to query attributes, then
***************
*** 776,783 ****
X  **    to the object containing the new attribute settings; When parsecntl
X  **    returns, then (assuming it returns 0) the desired attributes will have
X  **    been assigned and the object that contained the new attribute settings
! **    will now contain the attribute settings that were in effect before
! **    parsecntl was invoked.
X  */
X  typedef enum  {
X     pc_READ,
--- 777,784 ----
X  **    to the object containing the new attribute settings; When parsecntl
X  **    returns, then (assuming it returns 0) the desired attributes will have
X  **    been assigned and the object that contained the new attribute settings
! **    will now contain the attribute settings that were in effect immediately
! **    before parsecntl was invoked.
X  */
X  typedef enum  {
X     pc_READ,
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/parseargs.pl	Wed Apr 10 09:47:38 1991
--- parseargs.pl	Thu Apr 11 11:07:20 1991
***************
*** 30,36 ****
X  ;#    Any desired initial values for variables from the argument-description
X  ;#    string should be assigned BEFORE calling this function.
X  ;#
! ;#    The following global variables may be assigned before calling parseargs:
X  ;#
X  ;#       PARSEOPTS -- any extra options to pass to parseargs() (default="-u")
X  ;#
--- 30,37 ----
X  ;#    Any desired initial values for variables from the argument-description
X  ;#    string should be assigned BEFORE calling this function.
X  ;#
! ;#    The following global variables from package "main" may be assigned
! ;#    before calling parseargs:
X  ;#
X  ;#       PARSEOPTS -- any extra options to pass to parseargs() (default="-u")
X  ;#
***************
*** 44,49 ****
--- 45,52 ----
X  ;#    The exit code returned by parseargs(1).
X  ;#
X  ;# ^ALGORITHM:
+ ;#    - read $PARSECNTL environment variable and use corresponding syntax
+ ;#      (long-options or short options) when invoking parseargs(1)
X  ;#    - set defaults for PARSEOPTS
X  ;#    - build the parseargs command (dont forget to quote arguments).
X  ;#    - run parseargs(1) and evaluate the output unless $?
***************
*** 50,78 ****
X  ;##^^####
X  
X  sub parseargs {
!     local(@argv) = @_;
!     local($argd);
!     local($parse_output);
!     local($_);
!     local($[) = 0;
!     local($i);
X  
!     $argd = pop( @argv );   ## get last arg and remove it
X  
!     if ( $PARSEOPTS == "" ) {
!         $PARSEOPTS = '-u';
!     }
!     $PARSEARGS = 'parseargs -s perl ' . $PARSEOPTS . " -- '" . $0 . "'";
!     for ( $i = $[ ; $i <= $#argv ; $i++ ) {
!       $argv[$i] =~ s/'/'\\''/g;
!       $PARSEARGS .= " '" . $argv[$i] . "'";
!     }
!     $parse_output = `echo \'$argd\' | $PARSEARGS`;
!     eval $parse_output unless $?;
!     if ( $? ) {
X        $! = 0;
X        die "\n";
!     }
X  }
X  
X  1;
--- 53,81 ----
X  ;##^^####
X  
X  sub parseargs {
!    local($argd, @argv) = ( pop(@_), $0, @_ );
!    local($unset, $end, $sh, $env) = ( '-u', '--', '-s', '-e' );
!    local($parse_output, $_);
X  
!    $_ = $main'ENV{'PARSECNTL'};
!    if ( /[^!~\^]\s*[KkLl]/ ) {  ## KeyWords only!
!       ($unset, $end, $sh, $env) = ( '+unset', '++', '+shell', '+env' );
!    }
X  
!    if ( ! $main'PARSEOPTS )  { $main'PARSEOPTS = "$unset"; }
! 
!    grep( s/'/'\\''/g, @argv );  ## escape embedded quotes
!    $PARSEARGS = "parseargs $main'PARSEOPTS $sh perl $env ARGD $end ";
!    $PARSEARGS .= "'" . join( "' '", @argv ) . "'";
! 
!    $main'ENV{'ARGD'} = $argd;         ## put argd-array into environment
!    $parse_output = `$PARSEARGS`;      ## invoke parseargs(1)
!    eval $parse_output unless $?;      ## evaluate the output-script
!    if ( $? ) {
X        $! = 0;
X        die "\n";
!    }
!    return $?;
X  }
X  
X  1;
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/pgopen.c	Wed Apr 10 09:47:51 1991
--- pgopen.c	Thu Apr 11 11:07:27 1991
***************
*** 26,31 ****
--- 26,32 ----
X  
X  
X  #include <stdio.h>
+ #include <errno.h>
X  #include <signal.h>
X  #include <setjmp.h>
X  #include <useful.h>
***************
*** 71,79 ****
X  extern  int   access();
X  extern  int   isatty();
X  extern  int   wait();
! extern  int   sleep();
! 
! extern  int  errno;
X  
X  static void  pg_error();       /* broken-pipe exception handler */
X  static jmp_buf pg_recover;     /* jump-buffer for exception handler */
--- 72,78 ----
X  extern  int   access();
X  extern  int   isatty();
X  extern  int   wait();
! extern  unsigned   sleep();
X  
X  static void  pg_error();       /* broken-pipe exception handler */
X  static jmp_buf pg_recover;     /* jump-buffer for exception handler */
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/strfuncs.c	Wed Apr 10 09:47:55 1991
--- strfuncs.c	Thu Apr 11 11:07:42 1991
***************
*** 263,274 ****
X  
X        if (c1 != c2)  return  (int)(c1 -c2);
X     }
!    return   (*s1 == *s2) ? 0 : (int)(*s1 - *s2);
X  }
X  
X  
- #ifdef BSD
- 
X  /***************************************************************************
X  ** ^FUNCTION: strdup - copy a string
X  **
--- 263,272 ----
X  
X        if (c1 != c2)  return  (int)(c1 -c2);
X     }
!    return   (!len  ||  (*s1 == *s2)) ? 0 : (int)(*s1 - *s2);
X  }
X  
X  
X  /***************************************************************************
X  ** ^FUNCTION: strdup - copy a string
X  **
***************
*** 314,319 ****
--- 312,319 ----
X    return p;
X  }
X  
+ 
+ #ifdef BSD
X  
X  /***************************************************************************
X  ** ^FUNCTION: strpbrk - return the first occurrence of characters in a string
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/strfuncs.h	Wed Apr 10 09:47:57 1991
--- strfuncs.h	Thu Apr 11 11:07:45 1991
***************
*** 19,27 ****
X  EXTERN  char  *strlwr       ARGS(( char * ));
X  EXTERN  int    stricmp      ARGS(( const char *, const char * ));
X  EXTERN  int    strnicmp     ARGS(( const char *, const char *, size_t ));
X  
X  #ifdef BSD
-    EXTERN  char  *strdup    ARGS(( const char * ));
X     EXTERN  char  *strpbrk   ARGS(( const char *, const char * ));
X     EXTERN  int    strspn    ARGS(( const char *, const char * ));
X     EXTERN  int    strcspn   ARGS(( const char *, const char * ));
--- 19,27 ----
X  EXTERN  char  *strlwr       ARGS(( char * ));
X  EXTERN  int    stricmp      ARGS(( const char *, const char * ));
X  EXTERN  int    strnicmp     ARGS(( const char *, const char *, size_t ));
+ EXTERN  char  *strdup       ARGS(( const char * ));
X  
X  #ifdef BSD
X     EXTERN  char  *strpbrk   ARGS(( const char *, const char * ));
X     EXTERN  int    strspn    ARGS(( const char *, const char * ));
X     EXTERN  int    strcspn   ARGS(( const char *, const char * ));
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/syserr.c	Wed Apr 10 09:47:59 1991
--- syserr.c	Thu Apr 11 11:07:48 1991
***************
*** 21,26 ****
--- 21,27 ----
X  ***^^**********************************************************************/
X  
X  #include <stdio.h>
+ #include <errno.h>
X  #include <useful.h>
X  /* #include <funclist.h> */
X  
***************
*** 27,33 ****
X  VERSIONID("$Header: syserr.c,v 2.0 89/12/24 00:56:31 eric Exp $");
X  
X  extern  char *ProgName;
- extern  int   errno;
X  EXTERN  int   vfprintf  ARGS((FILE *, const char *, va_list));
X  
X  
--- 28,33 ----
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/unix_args.c	Wed Apr 10 09:48:06 1991
--- unix_args.c	Thu Apr 11 11:08:11 1991
***************
*** 167,174 ****
X           }
X  
X           flags = arg_flags(ad);
!          if ( ARG_isGIVEN(ad) )
!             BCLEAR( arg_flags(ad), ARGVALSEP | ARGVALGIVEN | ARGKEYWORD );
X  
X           BSET( arg_flags(ad), ARGKEYWORD );
X  
--- 167,176 ----
X           }
X  
X           flags = arg_flags(ad);
!          if ( ARG_isGIVEN(ad) ) {
!             BCLEAR( arg_flags(ad), ARGVALSEP | ARGKEYWORD );
!             if ( !ARG_isMULTIVAL(ad) )  BCLEAR( arg_flags(ad), ARGVALGIVEN );
!          }
X  
X           BSET( arg_flags(ad), ARGKEYWORD );
X  
***************
*** 275,282 ****
X              }/* if unknown-option */
X  
X              flags = arg_flags(ad);
!             if ( ARG_isGIVEN(ad) )
!                BCLEAR( arg_flags(ad), ARGVALSEP | ARGVALGIVEN | ARGKEYWORD );
X  
X              if( ARG_isMULTIVAL(ad) ) {
X                 cmd_list(cmd) = ad;
--- 277,286 ----
X              }/* if unknown-option */
X  
X              flags = arg_flags(ad);
!             if ( ARG_isGIVEN(ad) ) {
!                BCLEAR( arg_flags(ad), ARGVALSEP | ARGKEYWORD );
!                if ( !ARG_isMULTIVAL(ad) )  BCLEAR( arg_flags(ad), ARGVALGIVEN );
!             }
X  
X              if( ARG_isMULTIVAL(ad) ) {
X                 cmd_list(cmd) = ad;
***************
*** 354,364 ****
X        }/*elif option*/
X        else {
X              /* parsing a list of arguments */
!          if( cmd_list(cmd) ) {
X              ad = cmd_list(cmd);
X              flags = arg_flags(ad);
!             if ( ARG_isGIVEN(ad) )
!                BCLEAR( arg_flags(ad), ARGVALGIVEN | ARGVALSEP | ARGKEYWORD );
X  
X              BSET( arg_flags(ad), ARGVALSEP );
X  
--- 358,369 ----
X        }/*elif option*/
X        else {
X              /* parsing a list of arguments */
!          if ( cmd_list(cmd) ) {
X              ad = cmd_list(cmd);
X              flags = arg_flags(ad);
!             if ( ARG_isGIVEN(ad) ) {
!                BCLEAR( arg_flags(ad), ARGVALSEP | ARGKEYWORD );
!             }
X  
X              BSET( arg_flags(ad), ARGVALSEP );
X  
***************
*** 391,398 ****
X           }
X  
X           flags = arg_flags(ad);
!          if ( ARG_isGIVEN(ad) )
!             BCLEAR( arg_flags(ad), ARGVALGIVEN | ARGKEYWORD | ARGVALSEP );
X  
X           if ( ARG_isMULTIVAL(ad) ) {
X              cmd_list(cmd) = ad;
--- 396,405 ----
X           }
X  
X           flags = arg_flags(ad);
!          if ( ARG_isGIVEN(ad) ) {
!             BCLEAR( arg_flags(ad), ARGVALSEP | ARGKEYWORD );
!             if ( !ARG_isMULTIVAL(ad) )  BCLEAR( arg_flags(ad), ARGVALGIVEN );
!          }
X  
X           if ( ARG_isMULTIVAL(ad) ) {
X              cmd_list(cmd) = ad;
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/unix_man.c	Wed Apr 10 09:48:07 1991
--- unix_man.c	Thu Apr 11 11:08:16 1991
***************
*** 87,93 ****
X         return  strlen(name);
X     }/*if parm*/
X  
!    sprintf(buf, "\\fB\-%c\\fP", arg_cname(ad));
X     pos = buf + strlen(buf);
X  
X     if ( ARG_isVALTAKEN(ad)  &&  !ARG_isBOOLEAN(ad)  &&  !ARG_isPSEUDOARG(ad) ) {
--- 87,93 ----
X         return  strlen(name);
X     }/*if parm*/
X  
!    sprintf(buf, "\\fB\\-%c\\fP", arg_cname(ad));
X     pos = buf + strlen(buf);
X  
X     if ( ARG_isVALTAKEN(ad)  &&  !ARG_isBOOLEAN(ad)  &&  !ARG_isPSEUDOARG(ad) ) {
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/useful.h	Wed Apr 10 09:48:09 1991
--- useful.h	Thu Apr 11 11:08:19 1991
***************
*** 8,13 ****
--- 8,14 ----
X  **
X  ** ^HISTORY:
X  **    --/--/--	Brad Appleton	<brad at ssd.csd.harris.com>	
+ **    - Added OS specific #defines for unix, SYSV, BSD, etc ...
X  **    - Added structured block comments
X  **    - Added varargs/stdarg macros
X  **    - Added BSET, BCLEAR, BTEST macros for handling bitmasks
***************
*** 24,66 ****
X  #ifndef _USEFUL_H_
X  #define _USEFUL_H_
X  
! #ifndef unix
! # if (defined(_unix) || defined(_unix_) || defined(__unix) || defined(__unix__) || defined(UNIX) || defined(_UNIX) || defined(_UNIX_) || defined(__UNIX) || defined(__UNIX__) || defined(Unix) || defined(_Unix) || defined(_Unix_) || defined(__Unix) || defined(__Unix__) || defined(sun))
X  #   define unix
! # endif /* _UNIX */
! #endif /* unix */
X  
! #ifndef BSD
! # if (defined(ucb_universe) || defined(UCB) || defined(_BSD) || defined(_BSD_) || defined(__BSD) || defined(__BSD__) || defined(BSD_UNIX) || defined(_BSD_UNIX) || defined(_BSD_UNIX_) || defined(__BSD_UNIX) || defined(__BSD_UNIX__) || defined(sun))
X  #   define BSD
! # endif /* _BSD */
! #endif /* BSD */
X  
X  #ifndef AmigaDOS
! # if (defined(MANX) || defined(AZTEC))
X  #   define AmigaDOS
X  # endif
X  #endif /* AmigaDOS */
X  
- #ifndef vms
- # if (defined(_vms) || defined(_vms_) || defined(__vms) || defined(__vms__) || defined(VMS) || defined(_VMS) || defined(_VMS_) || defined(__VMS) || defined(__VMS__))
- #   define vms
- # endif /* _VMS */
- #endif /* vms */
X  
! #ifndef MSDOS
! # if (defined(_MSDOS) || defined(_MSDOS_) || defined(__MSDOS) || defined(__MSDOS__) || defined(MS_DOS) || defined(_MS_DOS) || defined(_MS_DOS_) || defined(__MS_DOS) || defined(__MS_DOS__))
! #   define MSDOS
! # endif /* _MSDOS */
! #endif /* MSDOS */
X  
- #ifndef OS2
- # if (defined(_OS2) || defined(_OS2_) || defined(__OS2) || defined(__OS2__))
- #   define OS2
- # endif /* _OS2 */
- #endif /* OS2 */
- 
- 
X  #ifndef FILE
X  # include <stdio.h>
X  #endif
--- 25,112 ----
X  #ifndef _USEFUL_H_
X  #define _USEFUL_H_
X  
! #if ( defined(_unix) || defined(UNIX) || defined(__UNIX) )
! # ifndef unix
X  #   define unix
! # endif
! #endif /* _unix */
X  
!    /* give a stab at the dual Unix universe dilemma (UCB vs AT&T) */
! #ifdef unix
! # if ( defined(_BSD) && !defined(BSD) )
! #  define BSD
! # endif
! # if ( defined(_SYSV) && !defined(SYSV) )
! #  define SYSV
! # endif
! 
! # ifndef BSD
! #  ifdef sun
X  #   define BSD
! #  endif
! #  ifdef apollo
! #   define BSD
! #  endif
! #  if ( defined(_CX_UX) && defined(ucb_universe) )
! #   define BSD
! #  endif
! #  if ( defined(VAX_BSD) || defined(ULTRIX) || defined(ultrix) )
! #   define BSD
! #  endif
! #  if ( defined(DYNIX) || defined(dynix) )
! #   define BSD
! #  endif
! #  if ( defined(UTX) || defined(utx) )
! #   define BSD
! #  endif
! # endif /* !BSD */
X  
+ # ifndef SYSV
+ #  ifdef mips
+ #   define SYSV
+ #  endif
+ #  ifdef DGUX
+ #   define SYSV
+ #  endif
+ #  if ( defined(_CX_UX) && defined(att_universe) )
+ #   define SYSV
+ #  endif
+ #  if ( defined(hpux) || defined(HPUX) )
+ #   define SYSV
+ #  endif
+ #  if ( defined(irix) || defined(IRIX) )
+ #   define SYSV
+ #  endif
+ #  if ( defined(aix) || defined(AIX) )
+ #   define SYSV
+ #  endif
+ # endif /* !SYSV */
+ #endif /* unix */
+ 
+ #ifndef MSDOS
+ # if ( defined(_MSDOS_) || defined(__MSDOS__) || defined(_MSDOS) )
+ #  define MSDOS
+ # endif
+ #endif
+ 
+ #ifndef OS2
+ # if ( defined(_OS2_) || defined(__OS2__) || defined(_OS2) )
+ #  define OS2
+ # endif
+ #endif
+ 
X  #ifndef AmigaDOS
! # if ( defined(MANX) || defined(AZTEC) )
X  #   define AmigaDOS
X  # endif
X  #endif /* AmigaDOS */
X  
X  
! #ifdef __STDC__
! # include <stddef.h>
! # include <stdlib.h>
! #endif
X  
X  #ifndef FILE
X  # include <stdio.h>
X  #endif
***************
*** 108,118 ****
X  #  define  VA_END(ap)         va_end(ap)
X  #endif
X  
- #if ( !defined(__ANSI_C__)  &&  !defined(_SIZE_T_DEFINED) )
-   typedef unsigned int size_t;
- # define _SIZE_T_DEFINED 1
- #endif
- 
X  #ifndef VOID
X  #  if ( defined(__ANSI_C__)  ||  !defined(NOVOID) )
X  #    define VOID		void
--- 154,159 ----
***************
*** 190,197 ****
X  #define BSET(bstr,mask)     (bstr) |= (mask)
X  #define BCLEAR(bstr,mask)   (bstr) &= ~(mask)
X  
! #ifndef STRING_H
! # define STRING_H
X     EXTERN  char  *strcat    ARGS(( char *, const char * ));
X     EXTERN  char  *strncat   ARGS(( char *, const char *, int ));
X     EXTERN  int    strcmp    ARGS(( const char *, const char * ));
--- 231,238 ----
X  #define BSET(bstr,mask)     (bstr) |= (mask)
X  #define BCLEAR(bstr,mask)   (bstr) &= ~(mask)
X  
! #ifndef __STRING_H
! # define __STRING_H
X     EXTERN  char  *strcat    ARGS(( char *, const char * ));
X     EXTERN  char  *strncat   ARGS(( char *, const char *, int ));
X     EXTERN  int    strcmp    ARGS(( const char *, const char * ));
***************
*** 218,229 ****
X     EXTERN  char  *rindex    ARGS(( const char *, int ));
X  # endif /* !BSD */
X     
! # ifdef BSD
X  #  define bcmp(b1,b2,n)   memcmp(b1,b2,n)
X  #  define bcopy(b1,b2,n)  memcpy(b2,b1,n)
X  #  define bzero(b,n)      memset(b,'\0',n)
! #  ifndef MEMORY_H
! #    define MEMORY_H
X     EXTERN  ARBPTR  memccpy   ARGS(( ARBPTR, const ARBPTR, int, int ));
X     EXTERN  ARBPTR  memchr    ARGS(( ARBPTR, int, int ));
X     EXTERN  int     memcmp    ARGS(( const ARBPTR, const ARBPTR, int ));
--- 259,270 ----
X     EXTERN  char  *rindex    ARGS(( const char *, int ));
X  # endif /* !BSD */
X     
! # ifndef BSD
X  #  define bcmp(b1,b2,n)   memcmp(b1,b2,n)
X  #  define bcopy(b1,b2,n)  memcpy(b2,b1,n)
X  #  define bzero(b,n)      memset(b,'\0',n)
! #  ifndef __MEMORY_H
! #    define __MEMORY_H
X     EXTERN  ARBPTR  memccpy   ARGS(( ARBPTR, const ARBPTR, int, int ));
X     EXTERN  ARBPTR  memchr    ARGS(( ARBPTR, int, int ));
X     EXTERN  int     memcmp    ARGS(( const ARBPTR, const ARBPTR, int ));
***************
*** 230,254 ****
X     EXTERN  ARBPTR  memcpy    ARGS(( ARBPTR, const ARBPTR, int ));
X     EXTERN  ARBPTR  memmove   ARGS(( ARBPTR, const ARBPTR, int ));
X     EXTERN  ARBPTR  memset    ARGS(( ARBPTR, int, int ));
! #  endif  /* MEMORY_H */
X     
X  # else
X  #  define memcmp(b1,b2,n)  bcmp(b1,b2,n)
X  #  define memcpy(b1,b2,n)  bcopy(b2,b1,n)
! #  ifndef BSTRING_H
! #    define BSTRING_H
X     EXTERN  VOID   bcopy     ARGS(( const ARBPTR, ARBPTR, int ));
X     EXTERN  int    bcmp      ARGS(( const ARBPTR, const ARBPTR, int ));
X     EXTERN  VOID   bzero     ARGS(( ARBPTR, int ));
X     EXTERN  int    ffs       ARGS(( int ));
! #  endif  /* BSTRING_H */
X  # endif /* !BSD */
! #endif /* STRING_H */
X  
! EXTERN  ARBPTR  malloc   ARGS(( size_t ));
X  EXTERN  ARBPTR  ckalloc  ARGS(( size_t ));
- EXTERN  ARBPTR  realloc  ARGS(( ARBPTR, size_t ));
- EXTERN  ARBPTR  free     ARGS(( ARBPTR ));
X  EXTERN  VOID    exit     ARGS(( int ));
X  
X  #define MAXINPUTLINE	200		/* maximum string input line */
--- 271,315 ----
X     EXTERN  ARBPTR  memcpy    ARGS(( ARBPTR, const ARBPTR, int ));
X     EXTERN  ARBPTR  memmove   ARGS(( ARBPTR, const ARBPTR, int ));
X     EXTERN  ARBPTR  memset    ARGS(( ARBPTR, int, int ));
! #  endif  /* __MEMORY_H */
X     
X  # else
X  #  define memcmp(b1,b2,n)  bcmp(b1,b2,n)
X  #  define memcpy(b1,b2,n)  bcopy(b2,b1,n)
! #  ifndef __BSTRING_H
! #    define __BSTRING_H
X     EXTERN  VOID   bcopy     ARGS(( const ARBPTR, ARBPTR, int ));
X     EXTERN  int    bcmp      ARGS(( const ARBPTR, const ARBPTR, int ));
X     EXTERN  VOID   bzero     ARGS(( ARBPTR, int ));
X     EXTERN  int    ffs       ARGS(( int ));
! #  endif  /* __BSTRING_H */
X  # endif /* !BSD */
! #endif /* __STRING_H */
X  
! #if ( !defined(__ANSI_C__)  &&  !defined(_SIZE_T_DEFINED) )
! # if (defined(sun) && defined(BSD))
! #  if (!defined (__sys_stdtypes_h))
! 	/* size_t is also defined in <sys/stdtypes.h> in SunOS 4.1 */
!     typedef int size_t;
! #  endif
! #  define _SIZE_T_DEFINED 1
! # endif /* sun */
! # if (defined(vms) && defined(__STDDEF_LOADED))
! #  define _SIZE_T_DEFINED 1
! # endif /* vms */
! # ifndef _SIZE_T_DEFINED
!    typedef unsigned int size_t;
! #  define _SIZE_T_DEFINED 1
! # endif  /* !_SIZE_T_DEFINED */
! #endif
! 
! #ifndef __malloc_h
!  EXTERN  ARBPTR  malloc   ARGS(( size_t ));
!  EXTERN  ARBPTR  realloc  ARGS(( ARBPTR, size_t ));
!  EXTERN  VOID    free     ARGS(( ARBPTR ));
! #endif /*__malloc_h*/
! 
X  EXTERN  ARBPTR  ckalloc  ARGS(( size_t ));
X  EXTERN  VOID    exit     ARGS(( int ));
X  
X  #define MAXINPUTLINE	200		/* maximum string input line */
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/vms_args.c	Wed Apr 10 09:48:11 1991
--- vms_args.c	Thu Apr 11 11:08:24 1991
***************
*** 655,662 ****
X           }
X              /* have we seen this one before */
X           flags = arg_flags(ad);
!          if ( ARG_isGIVEN(ad) )
!             BCLEAR( arg_flags(ad), ARGVALGIVEN | ARGVALSEP );
X  
X              /* ARGNOVALs are special, having no value */
X           if ( ! ARG_isVALTAKEN(ad) ) {
--- 655,664 ----
X           }
X              /* have we seen this one before */
X           flags = arg_flags(ad);
!          if ( ARG_isGIVEN(ad) ) {
!             BCLEAR( arg_flags(ad), ARGVALSEP );
!             if ( !ARG_isMULTIVAL(ad) )  BCLEAR( arg_flags(ad), ARGVALGIVEN );
!          }
X  
X              /* ARGNOVALs are special, having no value */
X           if ( ! ARG_isVALTAKEN(ad) ) {
***************
*** 712,719 ****
X           if ( cmd_list(cmd) ) {
X              ad = cmd_list(cmd);
X              flags = arg_flags(ad);
!             if ( ARG_isGIVEN(ad) )
!                BCLEAR( arg_flags(ad), ARGVALGIVEN | ARGVALSEP );
X  
X              BSET( arg_flags(ad), ARGVALSEP );
X  
--- 714,722 ----
X           if ( cmd_list(cmd) ) {
X              ad = cmd_list(cmd);
X              flags = arg_flags(ad);
!             if ( ARG_isGIVEN(ad) ) {
!                BCLEAR( arg_flags(ad), ARGVALSEP );
!             }
X  
X              BSET( arg_flags(ad), ARGVALSEP );
X  
***************
*** 753,760 ****
X              BSET( cmd_state(cmd), ps_NOFLAGS );
X           }
X           flags = arg_flags(ad);
!          if ( ARG_isGIVEN(ad) )
!             BCLEAR( arg_flags(ad), ARGVALGIVEN | ARGVALSEP );
X  
X           BSET( arg_flags(ad), ARGVALSEP );
X  
--- 756,765 ----
X              BSET( cmd_state(cmd), ps_NOFLAGS );
X           }
X           flags = arg_flags(ad);
!          if ( ARG_isGIVEN(ad) ) {
!             BCLEAR( arg_flags(ad), ARGVALSEP );
!             if ( !ARG_isMULTIVAL(ad) )  BCLEAR( arg_flags(ad), ARGVALGIVEN );
!          }
X  
X           BSET( arg_flags(ad), ARGVALSEP );
X  
***************
*** 973,981 ****
X              ll += pl;
X  
X                  /* show the argument */
!             if ( ARG_isREQUIRED(ad) )  fputc('[', fp);
X              fprintf(fp, buf);
!             if ( ARG_isREQUIRED(ad) )  fputc(']', fp);
X  
X              first = FALSE;  /* not first line anymore */
X           }/*for each ad */
--- 978,986 ----
X              ll += pl;
X  
X                  /* show the argument */
!             if ( !ARG_isREQUIRED(ad) )  fputc('[', fp);
X              fprintf(fp, buf);
!             if ( !ARG_isREQUIRED(ad) )  fputc(']', fp);
X  
X              first = FALSE;  /* not first line anymore */
X           }/*for each ad */
*** /hx1d3/lp/brad/parseargs_patch03/parseargs/xparse.c	Wed Apr 10 09:54:11 1991
--- xparse.c	Thu Apr 11 11:08:40 1991
***************
*** 21,32 ****
X  **    Each of these functions returns 0 upon success and non-zero otherwise
X  **    (except for usage() & init_args, which have no return value).
X  **
X  ** ^FILES:
X  **    <useful.h>
X  **    <parseargs.h>
X  **
X  ** ^SEE_ALSO:
! **    argtype(3), parseargs(1), parseargs(3), parsecntl(3),
X  **
X  ** ^CAVEATS:
X  **    Because of the way argument parsing is implemented under UNIX, MS-DOS
--- 21,47 ----
X  **    Each of these functions returns 0 upon success and non-zero otherwise
X  **    (except for usage() & init_args, which have no return value).
X  **
+ ** ^SIDE-EFFECTS:
+ **    Each of the functions in the parseargs library will set the external
+ **    character string ProgName to be the name of the last command that was
+ **    operated upon by any of the library routines.
+ **
+ **    When an argument-descriptor array is first encountered by any of the
+ **    parseargs library routines, it is initially compiled into an inter-
+ **    mediate form that is more convenient to manipulate. As a direct
+ **    result, it is not advisable to attempt to index directly into the
+ **    array to manipulate one of the argument descriptors (because the
+ **    argdesc that you thought was there may actually be somewhere else).
+ **    After the array has been given its initial value(s), only parsecntl(3)
+ **    should be used to manipulate or query the attributes of an argument
+ **    descriptor.
+ **
X  ** ^FILES:
X  **    <useful.h>
X  **    <parseargs.h>
X  **
X  ** ^SEE_ALSO:
! **    argtype(3), parseargs(1), parseargs(3)
X  **
X  ** ^CAVEATS:
X  **    Because of the way argument parsing is implemented under UNIX, MS-DOS
***************
*** 77,82 ****
--- 92,103 ----
X  **
X  ** ^HISTORY:
X  **    01/02/91 	Brad Appleton 	<brad at ssd.csd.harris.com> 	Created
+ **
+ **    04/03/91 	Brad Appleton 	<brad at ssd.csd.harris.com>
+ **    - fixed bug in [fvsl]parseargs() and parseargs().
+ **      previous parse-flags should not be reset until AFTER required
+ **      arguments are checked for, otherwise we may forget to prompt
+ **      for them if $PARSECNTL asked us to do so.
X  ***^^**********************************************************************/
X  
X  #include <stdio.h>
***************
*** 202,210 ****
--- 223,237 ----
X  #endif
X  
X  #ifdef vms_style
+ # ifdef vms
+    { '<', ARGHIDDEN, argInput, __ &stdin,   "INPUT (redirect SYS$INPUT)" },
+    { '>', ARGHIDDEN, argOutput, __ &stdout, "OUTPUT (redirect SYS$OUTPUT)" },
+    { '%', ARGHIDDEN, argOutput, __ &stderr, "ERROR (redirect SYS$ERROR)" },
+ # 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)" },
+ # endif
X  #endif
X  
X     END_ARGUMENTS
***************
*** 227,233 ****
X  #endif
X  
X  #ifdef vms
! #  define  getenv(s)   getsymbol(s)
X  #  define  envfree(s)  (s) = ( !(s) ) ? CHARNULL : (free(s), CHARNULL)
X  #  include <descrip.h>
X  #  include <libdef.h>
--- 254,260 ----
X  #endif
X  
X  #ifdef vms
! #  define  getenv(s)   get_symbol(s)
X  #  define  envfree(s)  (s) = ( !(s) ) ? CHARNULL : (free(s), CHARNULL)
X  #  include <descrip.h>
X  #  include <libdef.h>
***************
*** 749,755 ****
X        }
X  
X        /* try to convert what we read (remember - buf is transient) */
!       if (  HANDLE( ad, buf, TRUE ) )
X           BSET(arg_flags(ad), ARGGIVEN | ARGVALGIVEN);
X        else
X           error = TRUE;
--- 776,782 ----
X        }
X  
X        /* try to convert what we read (remember - buf is transient) */
!       if (  (*arg_type(ad))(ad, buf, TRUE) )
X           BSET(arg_flags(ad), ARGGIVEN | ARGVALGIVEN);
X        else
X           error = TRUE;
***************
*** 1010,1042 ****
X  **    refferred to as "terse" mode). The other two "modes" control the
X  **    displaying of option syntax and long-option syntax. A mode may be
X  **    explicitly disabled by preceding its corresponding string with the `!'
! **    character. The "modes" which correspond to the possible values of the
! **    "USAGECNTL" environment variable are given by the following table.
X  **
! **         "Quiet"        No usage message of any kind is displayed.
X  **
! **         "Silent"       Same as Quiet.
X  **
! **         "Paged"        The usage message is piped to a pager. The pager
! **                        used is named by the "USAGE_PAGER" environment
! **                        variable. If this variable is unset or empty (or
! **                        is not the name of an executable program), the
! **                        pager named by the "PAGER" environment variable
! **                        us used.  If this variable is unset or empty (or
! **                        is not the name of an executable program) then
! **                        the program "/usr/ucb/more" is used.
! **         "Description"  The command description is printed.
X  **
! **         "Terse"        Terse mode, just print command-line synopsis.
X  **
! **         "Verbose"      Verbose mode, print descriptions for each argument
X  **
! **         "Options"      Option syntax is displayed.
X  **
! **         "LongOpts"     Long-option syntax is displayed.
X  **
! **         "KeyWords"     Same as "LongOpts".
X  **
X  **    If the environment variable "USAGECNTL" is empty or undefined, then
X  **    the default usage level (which is presently "Verbose + Options")
X  **    will be used.
--- 1037,1077 ----
X  **    refferred to as "terse" mode). The other two "modes" control the
X  **    displaying of option syntax and long-option syntax. A mode may be
X  **    explicitly disabled by preceding its corresponding string with the `!'
! **    or `-' character. The "modes" which correspond to the possible values of
! **    the "USAGECNTL" environment variable are given by the following table.
X  **
! **    "Quiet"
! **       No usage message of any kind is displayed.
X  **
! **    "Silent"
! **       Same as Quiet.
X  **
! **    "Paged"
! **       The usage message is piped to a pager. The pager used is named by
! **       the "USAGE_PAGER" environment variable. If this variable is unset
! **       or empty (or is not the name of an executable program), the pager
! **       named by the "PAGER" environment variable us used.  If this variable
! **       is unset or empty (or is not the name of an executable program) then
! **       the program "/usr/ucb/more" is used.
X  **
! **    "Description"
! **       The command description is printed.
X  **
! **    "Terse"
! **       Terse mode, just print command-line synopsis.
X  **
! **    "Verbose"
! **       Verbose mode, print descriptions for each argument
X  **
! **    "Options"
! **       Option syntax is displayed.
X  **
! **    "LongOpts"
! **       Long-option syntax is displayed.
X  **
+ **    "KeyWords"
+ **       Same as "LongOpts".
+ **
X  **    If the environment variable "USAGECNTL" is empty or undefined, then
X  **    the default usage level (which is presently "Verbose + Options")
X  **    will be used.
***************
*** 1131,1180 ****
X  **    it with a `!' or `-' character.  The possible "flags" are given by
X  **    the following table. Flags are case-insensitive.
X  **
! **         "Prompt"      Prompt the user for any missing arguments that are
! **                       required on the command-line. No special escaping
! **                       or quoting is performed on the user input. Required
! **                       arguments that expect a list of values will be
! **                       repeatedly prompted for (one item per line) until a
! **                       blank line (followed by a carriage return) is
! **                       entered.
X  **
! **         "Ignore"      Ignore any unrecognized or improperly specified
! **                       command-line arguments and continue execution of
! **                       the program. Normally, if an argument is unmatched
! **                       (or is improperly specified), a usage message is
! **                       printed and program execution is terminated.
X  **
! **         "OptsOnly"    Under UNIX, setting this flag will disable the
! **                       parsing of long-option syntax. This will cause all
! **                       arguments starting with '+' to always be treated as
! **                       a positional parameter (instead of a long-option).
X  **
! **         "KwdsOnly"    Under UNIX, setting this flag disables the parsing
! **                       of single-character options.  This will cause all
! **                       arguments starting with '-' to always be treated as
! **                       a positional parameter (instead of an option).
X  **
! **         "LoptsOnly"   Same as KwdsOnly.
X  **
! **         "Flags1st"    Setting this flag causes the parseargs library to
! **                       force any and all non-positional arguments to be
! **                       specified before any positional ones.  As an exam-
! **                       ple, under UNIX, if this flag is SET then parseargs
! **                       will consider the command line "cmd -x arg" to con-
! **                       sist of one option and one positional argument;
! **                       however the command line "cmd arg -x" would be con-
! **                       sidered to consist of two positional arguments (the
! **                       -x option will be unmatched).
X  **
! **                       If this flag is UNSET, then both of the previous
! **                       examples are considered to consist of one option
! **                       and one positional argument.
X  **
! **         "CaseIgnore"  Setting this flag causes character-case to be
! **                       ignored when attempting to match single-character
! **                       argument names (i.e. causes "-i" and "-I" will be
! **                       considered equivalent).
X  **
X  **    If the environment variable "PARSECNTL" is empty or undefined, then the
X  **    parsing behavior set by the programmer is used.  If the programmer has
--- 1166,1213 ----
X  **    it with a `!' or `-' character.  The possible "flags" are given by
X  **    the following table. Flags are case-insensitive.
X  **
! **    "Prompt"
! **       Prompt the user for any missing arguments that are required on the
! **       command-line. No special escaping or quoting is performed on the
! **       user input. Required arguments that expect a list of values will
! **       be repeatedly prompted for (one item per line) until a blank line
! **       (followed by a carriage return) is entered.
X  **
! **    "Ignore"
! **       Ignore any unrecognized or improperly specified command-line arguments
! **       and continue execution of the program. Normally, if a required
! **       argument is unmatched (or an argument is improperly specified), a
! **       usage message is printed and program execution is terminated.
X  **
! **    "OptsOnly"
! **       Under UNIX, setting this flag will disable the parsing of long-option
! **       syntax. This will cause all arguments starting with '+' to always be
! **       treated as a positional parameter (instead of a long-option).
X  **
! **    "KwdsOnly"
! **       Under UNIX, setting this flag disables the parsing of single-character
! **       options.  This will cause all arguments starting with '-' to always be
! **       treated as a positional parameter (instead of an option).
X  **
! **    "LoptsOnly"
! **       Same as KwdsOnly.
X  **
! **    "Flags1st"
! **       Setting this flag causes the parseargs library to force any and all
! **       non-positional arguments to be specified before any positional ones.
! **       As an example, under UNIX, if this flag is SET then parseargs will
! **       consider the command line "cmd -x arg" to consist of one option and
! **       one positional argument; however the command line "cmd arg -x" would
! **       be considered to consist of two positional arguments (the -x option
! **       will be unmatched).
X  **
! **       If this flag is UNSET, then both of the previous examples are
! **       considered to consist of one option and one positional argument.
X  **
! **    "CaseIgnore"
! **       Setting this flag causes character-case to be ignored when attempting
! **       to match single-character argument names (i.e. causes "-i" and "-I"
! **       will be considered equivalent).
X  **
X  **    If the environment variable "PARSECNTL" is empty or undefined, then the
X  **    parsing behavior set by the programmer is used.  If the programmer has
***************
*** 1790,1796 ****
X    
X  /* ^DESCRIPTION:
X  **    Given a single string and an argdesc array, sparseargs will parse
! **    arguments from a string in much the same manner as parseargs.
X  **    Sparseargs will split the given string up into a vector of whitespace
X  **    separated tokens and then attempt to parse the resultant vector as if
X  **    it were given as argv[] on the command-line.  NO special treatment is
--- 1823,1829 ----
X    
X  /* ^DESCRIPTION:
X  **    Given a single string and an argdesc array, sparseargs will parse
! **    arguments from a string in the same manner as parseargs.
X  **    Sparseargs will split the given string up into a vector of whitespace
X  **    separated tokens and then attempt to parse the resultant vector as if
X  **    it were given as argv[] on the command-line.  NO special treatment is
***************
*** 1848,1856 ****
X  
X     rc = parse_argv_style( argv, parse_init( &argd ) );
X  
-       /* reset previous parse flags */
-    cmd_flags(argd)  =  saveflags;
- 
X        /* scan for missing required arguments */
X     if ( SYNTAX_ERROR(rc, argd) ) {
X        fputc( '\n', stderr );
--- 1881,1886 ----
***************
*** 1858,1863 ****
--- 1888,1896 ----
X        exit( 2 );
X     }
X  
+       /* reset previous parse flags */
+    cmd_flags(argd)  =  saveflags;
+ 
X     return  rc;
X  }
X  
***************
*** 1882,1888 ****
X  
X  /* ^DESCRIPTION:
X  **    Given a readable input stream and an argdesc array, fparseargs will
! **    parse arguments in a file in much the same manner as parseargs.  A
X  **    maximum-line length of 255 characters is imposed.  NO "escaping" of
X  **    any kind is performed. Comments of a limited form are permitted: if
X  **    the first non-whitespace character on a line is a '#' (or '!' for VMS)
--- 1915,1921 ----
X  
X  /* ^DESCRIPTION:
X  **    Given a readable input stream and an argdesc array, fparseargs will
! **    parse arguments in a file in the same manner as parseargs.  A
X  **    maximum-line length of 255 characters is imposed.  NO "escaping" of
X  **    any kind is performed. Comments of a limited form are permitted: if
X  **    the first non-whitespace character on a line is a '#' (or '!' for VMS)
***************
*** 1961,1968 ****
X        BSET(cmd_flags(argd), pa_CONTINUE);
X     }/*while !EOF*/
X  
!       /* reset previous parse flags */
!    cmd_flags(argd)  =  saveflags;
X  
X        /* scan for missing required args */
X     if ( SYNTAX_ERROR(rc, argd) ) {
--- 1994,2000 ----
X        BSET(cmd_flags(argd), pa_CONTINUE);
X     }/*while !EOF*/
X  
!    if ( !BTEST(saveflags, pa_NOCHECK) )  BCLEAR(cmd_flags(argd), pa_NOCHECK);
SHAR_EOF
true || echo 'restore of PATCH failed'
echo 'End of  part 3'
echo 'File PATCH is continued in part 4'
echo 4 > _shar_seq_.tmp
exit 0
exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent at 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 at uunet.uu.net.



More information about the Comp.sources.misc mailing list