v20i046: parseargs - functions to parse command line arguments, Patch06

Brad Appleton brad at hcx1.ssd.csd.harris.com
Sat Jun 8 12:09:07 AEST 1991


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

This is patch06 for parseargs. Its includes the following changes:

    - parsecntl(3) now correctly handles mispelled keywords for the
      pc_ARGFLAGS request (it was looping forever).
    - fixed an error in the documentation (a "NOT" was omitted).
    - added #ifdef SVR4 stuff to unix_man.c to print System V Release 4
      style manual pages.
    - allowed "sname=aname" syntax in the ad_prompt field of an ARGDESC
      in addition to the existing syntax. This new syntax allows argument
      names to be be completely different from keyword names.
    - changed get_name() & get_keyword to get_argname() & get_kwdname()
      (respectively) in strfuncs.[ch]. Also sped up the algorithm to get
      the keyword (since it no longer needs malloc).

This patch consists of the file PATCH which is a set of context diffs to 
be fed to the patch program.

To apply this patch:

   1) cd to the directory containing the source for parseargs,
   2) unshar this archive,
   4) type "patch -p0 < PATCH" to apply the patches

______________________ "And miles to go before I sleep." ______________________
 Brad Appleton           brad at ssd.csd.harris.com       Harris Computer Systems
                             uunet!hcx1!brad           Fort Lauderdale, FL USA
~~~~~~~~~~~~~~~~~~~~ Disclaimer: I said it, not my company! ~~~~~~~~~~~~~~~~~~~

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix at uunet.uu.net if you want that tool.
# Contents:  PATCH
# Wrapped by kent at sparky on Fri Jun  7 20:53:09 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo '          "shar: End of archive."'
if test -f 'PATCH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'PATCH'\"
else
  echo shar: Extracting \"'PATCH'\" \(50339 characters\)
  sed "s/^X//" >'PATCH' <<'END_OF_FILE'
X*** Intro.OLD	Mon Jun  3 11:13:52 1991
X--- Intro	Wed May 22 14:47:07 1991
X***************
X*** 83,89 ****
X  
X   And before you know it, your command-line had been parsed, all variables 
X   have been assigned their corresponding values from the command-line, syntax
X!  has been verified, and a usage message (if required) has been printed. 
X  
X   Under UNIX, the command-line syntax (using single character options) for the
X   above command would be:
X--- 83,89 ----
X  
X   And before you know it, your command-line had been parsed, all variables 
X   have been assigned their corresponding values from the command-line, syntax
X!  have been verified, and a usage message (if required) has been printed. 
X  
X   Under UNIX, the command-line syntax (using single character options) for the
X   above command would be:
X***************
X*** 108,114 ****
X      cmdname [/a[=<areacode>]] [/g=<newsgroups>...] [/r=<repcount>]
X              [/s=<sepchar>] [/x]  <name>  [<args>...]
X  
X!   The AmigaDOS command-line syntax would be the following:
X  
X      cmdname [AREA [<areacode>]] [GROUPS <newsgroups>...] [REP <repcount>]
X              [SEP <sepchar>] [X]  <name>  [<args>...]
X--- 108,114 ----
X      cmdname [/a[=<areacode>]] [/g=<newsgroups>...] [/r=<repcount>]
X              [/s=<sepchar>] [/x]  <name>  [<args>...]
X  
X!  The AmigaDOS command-line syntax would be the following:
X  
X      cmdname [AREA [<areacode>]] [GROUPS <newsgroups>...] [REP <repcount>]
X              [SEP <sepchar>] [X]  <name>  [<args>...]
X*** README.OLD	Mon Jun  3 11:14:12 1991
X--- README	Wed May 22 14:56:09 1991
X***************
X*** 290,295 ****
X--- 290,296 ----
X   I also added the capability to handle ARGVEC arguments into the
X   remaining argument type functions.
X  
X+ 
X   NEW ARGUMENT FLAGS:
X   ===================
X   I added the following argument flags to parseargs:
X***************
X*** 306,311 ****
X--- 307,313 ----
X  
X   Consult the manual page for parseargs(1) & parseargs(3) for more information.
X  
X+ 
X   NEW INTERFACE
X   =============
X   I added a set of Macros to allow a more "self documenting" approach to
X***************
X*** 336,341 ****
X--- 338,344 ----
X   variable.  See the parseargs(3) and parseargs(1) manual pages for more
X   information regarding USAGECNTL.
X  
X+ 
X   SPECIFYING ALTERNATE PARSING BEHAVIOR
X   =====================================
X   Parseargs provides 3 methods for controlling "how" the command-line is
X***************
X*** 351,356 ****
X--- 354,360 ----
X   See the manual pages for parseargs(1), parseargs(3), and parsecntl(3)
X   for more information.
X  
X+ 
X   GIVING DEFAULT ARGUMENTS
X   ========================
X   Programs that use parseargs may be given default arguments under UNIX
X***************
X*** 379,389 ****
X   relatively easy to add new shell-types. At this point in time, parseargs
X   will generate output for the following command-interpreters:
X  
X!      sh           (Bourne Shell)
X!      csh/tcsh     (C-Shell)
X!      bash         (Bourne-Again Shell)
X!      ksh          (Korn Shell)
X!      rc           (Plan 9 Shell)
X       perl
X       awk
X  
X--- 383,394 ----
X   relatively easy to add new shell-types. At this point in time, parseargs
X   will generate output for the following command-interpreters:
X  
X!      sh               (Bourne Shell)
X!      csh/tcsh/itcsh   (C-Shell)
X!      bash             (Bourne-Again Shell)
X!      ksh              (Korn Shell)
X!      rc               (Plan 9 Shell)
X!      zsh              (Z shell)
X       perl
X       awk
X  
X*** amiga_args.c.OLD	Mon Jun  3 11:14:17 1991
X--- amiga_args.c	Mon May 13 13:44:24 1991
X***************
X*** 144,150 ****
X                 BSET( arg_flags(cmd_prev(cmd)), ARGGIVEN );
X              }
X              else {  /* value was required */
X!                (VOID)get_keyword( arg_sname(cmd_prev(cmd)), keyword );
X                 usrerr( "value required for %s keyword", keyword );
X                 parse_error = pe_SYNTAX;
X              }
X--- 144,150 ----
X                 BSET( arg_flags(cmd_prev(cmd)), ARGGIVEN );
X              }
X              else {  /* value was required */
X!                (VOID)get_kwdname( arg_sname(cmd_prev(cmd)), keyword );
X                 usrerr( "value required for %s keyword", keyword );
X                 parse_error = pe_SYNTAX;
X              }
X***************
X*** 310,316 ****
X           BSET( arg_flags(cmd_prev(cmd)), ARGGIVEN );
X        }
X        else {  /* value was required */
X!          (VOID)get_keyword( arg_sname(cmd_prev(cmd)), keyword );
X           usrerr( "value required for %s keyword", keyword );
X           parse_error = pe_SYNTAX;
X        }
X--- 310,316 ----
X           BSET( arg_flags(cmd_prev(cmd)), ARGGIVEN );
X        }
X        else {  /* value was required */
X!          (VOID)get_kwdname( arg_sname(cmd_prev(cmd)), keyword );
X           usrerr( "value required for %s keyword", keyword );
X           parse_error = pe_SYNTAX;
X        }
X***************
X*** 366,378 ****
X     char * pos;
X     argName_t  keyword, name;
X  
X!    (VOID) get_name(arg_sname(ad), name);
X  
X     if ( ARG_isPOSITIONAL(ad) ) {
X        sprintf( buf, "<%s>", name );
X     }
X     else {
X!       (VOID) get_keyword(arg_sname(ad), keyword);
X        (VOID) strcpy( buf, keyword );
X        pos = buf + strlen(buf);
X  
X--- 366,378 ----
X     char * pos;
X     argName_t  keyword, name;
X  
X!    (VOID) get_argname(arg_sname(ad), name);
X  
X     if ( ARG_isPOSITIONAL(ad) ) {
X        sprintf( buf, "<%s>", name );
X     }
X     else {
X!       (VOID) get_kwdname(arg_sname(ad), keyword);
X        (VOID) strcpy( buf, keyword );
X        pos = buf + strlen(buf);
X  
X*** arglist.c.OLD	Mon Jun  3 11:14:22 1991
X--- arglist.c	Mon May 13 13:44:24 1991
X***************
X*** 94,100 ****
X     ArgListHead *nl;
X     ArgList *nd;
X  
X!    (VOID) get_name( arg_sname(ad), argname );
X     if (copyf) {
X        register int i;
X  
X--- 94,100 ----
X     ArgListHead *nl;
X     ArgList *nd;
X  
X!    (VOID) get_argname( arg_sname(ad), argname );
X     if (copyf) {
X        register int i;
X  
X*** argtype.c.OLD	Mon Jun  3 11:14:26 1991
X--- argtype.c	Mon May 13 13:44:25 1991
X***************
X*** 202,208 ****
X     char *cp;
X     argName_t  argname;
X  
X!    (VOID) get_name( arg_sname(ad), argname );
X     if (copyf) {
X        register int i;
X  
X--- 202,208 ----
X     char *cp;
X     argName_t  argname;
X  
X!    (VOID) get_argname( arg_sname(ad), argname );
X     if (copyf) {
X        register int i;
X  
X***************
X*** 270,276 ****
X     int status = FALSE;
X     char c;
X  
X!    (VOID) get_name( arg_sname(ad), argname );
X     if (!vp || !*vp) {
X        status = FALSE;
X     }
X--- 270,276 ----
X     int status = FALSE;
X     char c;
X  
X!    (VOID) get_argname( arg_sname(ad), argname );
X     if (!vp || !*vp) {
X        status = FALSE;
X     }
X***************
X*** 340,346 ****
X     argName_t  argname; \
X     num_t  value; \
X   \
X!    (VOID) get_name( arg_sname(ad), argname ); \
X     value = (num_t) strtol(vp, &vpp, 0); \
X     if (*vpp != '\0') { \
X        usrerr("invalid integer argument '%s' for %s", vp, argname); \
X--- 340,346 ----
X     argName_t  argname; \
X     num_t  value; \
X   \
X!    (VOID) get_argname( arg_sname(ad), argname ); \
X     value = (num_t) strtol(vp, &vpp, 0); \
X     if (*vpp != '\0') { \
X        usrerr("invalid integer argument '%s' for %s", vp, argname); \
X***************
X*** 401,407 ****
X     argName_t  argname; \
X     dec_t  value; \
X   \
X!    (VOID) get_name( arg_sname(ad), argname ); \
X     value = (dec_t) strtod(vp, &vpp); \
X     if (*vpp != '\0') { \
X        usrerr("invalid decimal argument '%s' for %s", vp, argname); \
X--- 401,407 ----
X     argName_t  argname; \
X     dec_t  value; \
X   \
X!    (VOID) get_argname( arg_sname(ad), argname ); \
X     value = (dec_t) strtod(vp, &vpp); \
X     if (*vpp != '\0') { \
X        usrerr("invalid decimal argument '%s' for %s", vp, argname); \
X***************
X*** 504,510 ****
X     argName_t  argname;
X     int len;
X  
X!    (VOID) get_name( arg_sname(ad), argname );
X  
X     /* ARGVECs are not supported for this Boolean arg-types */
X     if ( ARG_isVEC(ad) )
X--- 504,510 ----
X     argName_t  argname;
X     int len;
X  
X!    (VOID) get_argname( arg_sname(ad), argname );
X  
X     /* ARGVECs are not supported for this Boolean arg-types */
X     if ( ARG_isVEC(ad) )
X***************
X*** 574,580 ****
X     argName_t  argname;
X     BOOL  retval;
X  
X!    (VOID) get_name( arg_sname(ad), argname );
X  
X     /* ARGVECs are not supported for this Boolean arg-types */
X     if ( ARG_isVEC(ad) )
X--- 574,580 ----
X     argName_t  argname;
X     BOOL  retval;
X  
X!    (VOID) get_argname( arg_sname(ad), argname );
X  
X     /* ARGVECs are not supported for this Boolean arg-types */
X     if ( ARG_isVEC(ad) )
X***************
X*** 596,602 ****
X     argName_t  argname;
X     BOOL  retval;
X  
X!    (VOID) get_name( arg_sname(ad), argname );
X  
X     /* ARGVECs are not supported for this Boolean arg-types */
X     if ( ARG_isVEC(ad) )
X--- 596,602 ----
X     argName_t  argname;
X     BOOL  retval;
X  
X!    (VOID) get_argname( arg_sname(ad), argname );
X  
X     /* ARGVECs are not supported for this Boolean arg-types */
X     if ( ARG_isVEC(ad) )
X***************
X*** 618,624 ****
X     argName_t  argname;
X     BOOL  retval;
X  
X!    (VOID) get_name( arg_sname(ad), argname );
X  
X     /* ARGVECs are not supported for this Boolean arg-types */
X     if ( ARG_isVEC(ad) )
X--- 618,624 ----
X     argName_t  argname;
X     BOOL  retval;
X  
X!    (VOID) get_argname( arg_sname(ad), argname );
X  
X     /* ARGVECs are not supported for this Boolean arg-types */
X     if ( ARG_isVEC(ad) )
X*** doc/Makefile.OLD	Mon Jun  3 11:14:32 1991
X--- doc/Makefile	Tue May 14 14:38:21 1991
X***************
X*** 144,150 ****
X  clobber: clean
X  	${DEL} *.txt
X  
X! spell: ${INCS} ${SRCS}}
X  	${SPELL} ${SPELLFLAGS} ${INCS} ${SRCS}
X  
X  print: ${MANFILES} ${INCS}
X--- 144,150 ----
X  clobber: clean
X  	${DEL} *.txt
X  
X! spell: ${INCS} ${SRCS}
X  	${SPELL} ${SPELLFLAGS} ${INCS} ${SRCS}
X  
X  print: ${MANFILES} ${INCS}
X*** doc/argdesc.inc.OLD	Mon Jun  3 11:14:40 1991
X--- doc/argdesc.inc	Sat May 11 12:17:40 1991
X***************
X*** 49,57 ****
X  description (the description must be separated from the long-name by
X  at least one whitespace character and may optionally be enclosed in
X  a set of balanced delimiters (such as parentheses, curly-braces,
X! square-brackets, or angle-brackets). If the long-name contains any
X  uppercase characters, then the substring of long-name consisting of
X! all uppercase characters is used as the argument keyword and the entire
X! long-name is used as the name of the argument (if a value may be
X! supplied). The long-name may be matched by supplying a unique prefix
X! of either the argument keyword or the argument name.
X--- 49,63 ----
X  description (the description must be separated from the long-name by
X  at least one whitespace character and may optionally be enclosed in
X  a set of balanced delimiters (such as parentheses, curly-braces,
X! square-brackets, or angle-brackets). The longname may be specifed
X! in two parts: a keyword name and an argument name. The argument
X! name may be separated from the keyword name by a single equal sign
X! (`='). No whitespace is allowed before or after the equal sign.
X! 
X! Alternatatively, the keyword name may be distinguished from the
X! argument name by character case: if the long-name contains any
X  uppercase characters, then the substring of long-name consisting of
X! all uppercase characters is used as the argument keyword and the
X! entire long-name is used as the name of the argument (if a value may
X! be supplied). The long-name may be matched by supplying a unique
X! prefix of either the argument keyword or the argument name.
X*** doc/parseargs.man1.OLD	Mon Jun  3 11:15:49 1991
X--- doc/parseargs.man1	Sat May 11 12:20:43 1991
X***************
X*** 158,163 ****
X--- 158,176 ----
X  and printed in usage messages. This string may be followed by a
X  textual description that is enclosed in parentheses, square brackets,
X  curly braces, or angle brackets.
X+ 
X+ The prompt-string may be specifed
X+ in two parts: a keyword name and an argument name. The argument
X+ name may be separated from the keyword name by a single equal sign
X+ ('='). No whitespace is allowed before or after the equal sign.
X+ 
X+ Alternatatively, the keyword name may be distinguished from the
X+ argument name by character case: if the long-name contains any
X+ uppercase characters, then the substring of long-name consisting of
X+ all uppercase characters is used as the argument keyword and the
X+ entire long-name is used as the name of the argument (if a value may
X+ be supplied). The long-name may be matched by supplying a unique
X+ prefix of either the argument keyword or the argument name.
X  .PP
X  The argument specification string must be terminated by the single string:
X  ``ENDOFARGS''.
X*** doc/returns.inc.OLD	Mon Jun  3 11:16:33 1991
X--- doc/returns.inc	Mon May 20 17:36:20 1991
X***************
X*** 28,35 ****
X  .IP "\fIpe_\s-1NOMATCH\s+1\fP"
X  Unable to match the named argument. This occurs
X  when the argument keyword name passed to \fIparsecntl\fP (using the 
X! \fIpc_\s-1ARGFLAGS\s+1\fP functions code) was found in the given argdesc-array
X! or in its default-list.
X  .\"---------------------------------------------
X  .IP "\fIpe_\s-1BADMODE\s+1\fP"
X  Bad mode for given command in \fIparsecntl\fP. This occurs when 
X--- 28,35 ----
X  .IP "\fIpe_\s-1NOMATCH\s+1\fP"
X  Unable to match the named argument. This occurs
X  when the argument keyword name passed to \fIparsecntl\fP (using the 
X! \fIpc_\s-1ARGFLAGS\s+1\fP functions code) was NOT found in the given
X! argdesc-array or in its default-list.
X  .\"---------------------------------------------
X  .IP "\fIpe_\s-1BADMODE\s+1\fP"
X  Bad mode for given command in \fIparsecntl\fP. This occurs when 
X*** ibm_args.c.OLD	Mon Jun  3 11:17:03 1991
X--- ibm_args.c	Mon May 13 13:44:26 1991
X***************
X*** 301,307 ****
X                    BSET( arg_flags(ad), ARGGIVEN );
X                 }
X                 else {
X!                   (VOID) get_keyword( arg_sname(ad), name );
X                    usrerr("%c%s switch requires an argument", KwdPrefix, name);
X                    arg_flags(ad) = flags;
X                    parse_error = pe_SYNTAX;
X--- 301,307 ----
X                    BSET( arg_flags(ad), ARGGIVEN );
X                 }
X                 else {
X!                   (VOID) get_kwdname( arg_sname(ad), name );
X                    usrerr("%c%s switch requires an argument", KwdPrefix, name);
X                    arg_flags(ad) = flags;
X                    parse_error = pe_SYNTAX;
X***************
X*** 429,435 ****
X                       BSET( arg_flags(ad), ARGGIVEN );
X                    }
X                    else {
X!                      (VOID) get_name(arg_sname(ad), name);
X                       usrerr( "%s required for %c%c flag",
X                               name, OptPrefix, arg_cname(ad) );
X                       arg_flags(ad) = flags;
X--- 429,435 ----
X                       BSET( arg_flags(ad), ARGGIVEN );
X                    }
X                    else {
X!                      (VOID) get_argname(arg_sname(ad), name);
X                       usrerr( "%s required for %c%c flag",
X                               name, OptPrefix, arg_cname(ad) );
X                       arg_flags(ad) = flags;
X***************
X*** 585,597 ****
X     char *pos;
X     argName_t   name, keyword;
X  
X!    (VOID) get_name( arg_sname(ad), name );
X  
X     if (ARG_isPOSITIONAL(ad)) {
X        sprintf( buf, "<%s>", name );
X     }
X     else {
X!       (VOID) get_keyword( arg_sname(ad), keyword );
X  
X        if ( isupper(arg_cname(ad))  &&  toupper(*keyword) == arg_cname(ad) ) {
X           *keyword = toupper(*keyword);
X--- 585,597 ----
X     char *pos;
X     argName_t   name, keyword;
X  
X!    (VOID) get_argname( arg_sname(ad), name );
X  
X     if (ARG_isPOSITIONAL(ad)) {
X        sprintf( buf, "<%s>", name );
X     }
X     else {
X!       (VOID) get_kwdname( arg_sname(ad), keyword );
X  
X        if ( isupper(arg_cname(ad))  &&  toupper(*keyword) == arg_cname(ad) ) {
X           *keyword = toupper(*keyword);
X*** parseargs.awk.OLD	Mon Jun  3 11:17:09 1991
X--- parseargs.awk	Wed May 15 10:03:26 1991
X***************
X*** 40,46 ****
X  ##    The following global variables may be assigned before calling parseargs:
X  ##
X  ##       PROGNAME -- name of the current awk script (default= ARGV[0])
X! ##       PARSEOPTS -- any extra options to pass toi parseargs() (default="-ul")
X  ##       PARSEINPUT -- input file for parseargs(1) (default=unique-name)
X  ##       PARSEOUTPUT -- output file for parseargs(1) (default=unique-name)
X  ##
X--- 40,46 ----
X  ##    The following global variables may be assigned before calling parseargs:
X  ##
X  ##       PROGNAME -- name of the current awk script (default= ARGV[0])
X! ##       PARSEOPTS -- any extra options to pass to parseargs() (default="-ul")
X  ##       PARSEINPUT -- input file for parseargs(1) (default=unique-name)
X  ##       PARSEOUTPUT -- output file for parseargs(1) (default=unique-name)
X  ##
X*** parseargs.c.OLD	Mon Jun  3 11:17:16 1991
X--- parseargs.c	Thu May 16 16:51:21 1991
X***************
X*** 1092,1098 ****
X  #endif
X  {
X     int  i;
X!    register char *sh = sh_str;
X  
X        /* special case to recognize tcsh & itcsh */
X     if ( strEQ( sh, "tcsh" ) )  ++sh;
X--- 1092,1098 ----
X  #endif
X  {
X     int  i;
X!    register CONST char *sh = sh_str;
X  
X        /* special case to recognize tcsh & itcsh */
X     if ( strEQ( sh, "tcsh" ) )  ++sh;
X*** parseargs.h.OLD	Mon Jun  3 11:17:24 1991
X--- parseargs.h	Mon May 20 17:35:46 1991
X***************
X*** 97,103 ****
X  **       description (the description must be separated from the long-name by
X  **       at least one whitespace character and may optionally be enclosed in
X  **       a set of balanced delimiters (such as parentheses, curly-braces,
X! **       square-brackets, or angle-brackets). If the long-name contains any
X  **       uppercase characters, then the substring of long-name consisting of
X  **       all uppercase characters is used as the argument keyword and the
X  **       entire long-name is used as the name of the argument (if a value may
X--- 97,108 ----
X  **       description (the description must be separated from the long-name by
X  **       at least one whitespace character and may optionally be enclosed in
X  **       a set of balanced delimiters (such as parentheses, curly-braces,
X! **       square-brackets, or angle-brackets). The longname may be specifed
X! **       in two parts: a keyword name and an argument name. The argument
X! **       name may be separated from the keyword name by a single equal sign
X! **       ('='). No whitespace is allowed before or after the equal sign.
X! **       Alternatatively, the keyword name may be distinguished from the
X! **       argument name by character case: if the long-name contains any
X  **       uppercase characters, then the substring of long-name consisting of
X  **       all uppercase characters is used as the argument keyword and the
X  **       entire long-name is used as the name of the argument (if a value may
X***************
X*** 140,146 ****
X  #define  pe_NOMATCH   3
X  /*    -- unable to match the named argument. This occurs
X  **       when the argument keyword name passed to parsecntl() (using the 
X! **       pc_ARGFLAGS functions code) was found in the given argdesc-array
X  **       or in its default-list.
X  */
X  #define  pe_BADMODE   4
X--- 145,151 ----
X  #define  pe_NOMATCH   3
X  /*    -- unable to match the named argument. This occurs
X  **       when the argument keyword name passed to parsecntl() (using the 
X! **       pc_ARGFLAGS function code) was NOT found in the given argdesc-array
X  **       or in its default-list.
X  */
X  #define  pe_BADMODE   4
X*** parseargs.pl.OLD	Mon Jun  3 11:17:30 1991
X--- parseargs.pl	Wed May 15 10:02:06 1991
X***************
X*** 39,45 ****
X  ;#    The global variable PARSEARGS will contain the command-line used to
X  ;#    invoke parseargs(1).
X  ;#
X! ;#    ARGV and ARGC may be reset, all other values are (re)set in <arr>.
X  ;#
X  ;# ^RETURN-VALUE:
X  ;#    The exit code returned by parseargs(1).
X--- 39,45 ----
X  ;#    The global variable PARSEARGS will contain the command-line used to
X  ;#    invoke parseargs(1).
X  ;#
X! ;#    ARGV and (and any other variables named in <argd>) may be overwritten.
X  ;#
X  ;# ^RETURN-VALUE:
X  ;#    The exit code returned by parseargs(1).
X*** patchlevel.h.OLD	Mon Jun  3 11:17:35 1991
X--- patchlevel.h	Mon Jun  3 10:35:24 1991
X***************
X*** 2,7 ****
X--- 2,21 ----
X  ** ^FILE: patchlevel.h - current patchlevel for parseargs
X  **
X  ** ^HISTORY:
X+ **    05/11/91	Brad Appleton	<brad at ssd.csd.harris.com>
X+ **    Patch06
X+ **    - parsecntl(3) now correctly handles mispelled keywords for the
X+ **      pc_ARGFLAGS request (it was looping forever).
X+ **    - fixed an error in the documentation (a "NOT" was omitted).
X+ **    - added #ifdef SVR4 stuff to unix_man.c to print System V Release 4
X+ **      style manual pages.
X+ **    - allowed "sname=aname" syntax in the ad_prompt field of an ARGDESC
X+ **      in addition to the existing syntax. This new syntax allows argument
X+ **      names to be be completely different from keyword names.
X+ **    - changed get_name() & get_keyword to get_argname() & get_kwdname()
X+ **      (respectively) in strfuncs.[ch]. Also sped up the algorithm to get
X+ **      the keyword (since it no longer needs malloc).
X+ **
X  **    04/25/91	Brad Appleton	<brad at ssd.csd.harris.com>
X  **    Patch05
X  **    - documented support for zsh in parseargs(1)
X***************
X*** 66,72 ****
X  
X  #define  VERSION     2
X  #define  REVISION    0
X! #define  PATCHLEVEL  5
X  
X  #ifdef __STDC__
X     static const char
X--- 80,86 ----
X  
X  #define  VERSION     2
X  #define  REVISION    0
X! #define  PATCHLEVEL  6
X  
X  #ifdef __STDC__
X     static const char
X***************
X*** 73,76 ****
X  #else
X     static char
X  #endif
X!    _Ident[] = "@(#)parseargs  2.0  patchlevel 5";
X--- 87,90 ----
X  #else
X     static char
X  #endif
X!    _Ident[] = "@(#)parseargs  2.0  patchlevel 6";
X*** stest.c.OLD	Mon Jun  3 11:17:47 1991
X--- stest.c	Mon Jun  3 10:34:00 1991
X***************
X*** 115,121 ****
X     'n', ARGREQ|ARGPOS, argStr,  __ &Name,  "name (name to look for)",
X     's', ARGVALOPT, argStr,  __ &Str,       "STRing (optional string to use)",
X     'g', ARGVEC,    argStr,  __ &Groups,    "newsGROUPS (newsgroups to test)",
X!    'c', ARGOPT,    argInt,  __ &RepCount,  "REPcount (repeat count per group)",
X     'd', ARGOPT,    argStr,   __ &DirName,  "DIRname (work directory)",
X     'i', ARGVEC,    argInt,   __ &Integers, "INTegerS (vector of numbers)",
X     '#', ARGHIDDEN, argBool,  __ &XRated,   "XratedMODE (naughty! naughty!)",
X--- 115,121 ----
X     'n', ARGREQ|ARGPOS, argStr,  __ &Name,  "name (name to look for)",
X     's', ARGVALOPT, argStr,  __ &Str,       "STRing (optional string to use)",
X     'g', ARGVEC,    argStr,  __ &Groups,    "newsGROUPS (newsgroups to test)",
X!    'c', ARGOPT,    argInt,  __ &RepCount,  "REP=count (repeat count per group)",
X     'd', ARGOPT,    argStr,   __ &DirName,  "DIRname (work directory)",
X     'i', ARGVEC,    argInt,   __ &Integers, "INTegerS (vector of numbers)",
X     '#', ARGHIDDEN, argBool,  __ &XRated,   "XratedMODE (naughty! naughty!)",
X***************
X*** 124,130 ****
X     'y', ARGOPT, argUBool, __ &YFlag, "Yflag (unset Y flag)",
X     'z', ARGOPT, argTBool, __ &ZFlag, "Zflag (toggle Z flag)",
X  
X!    't', ARGOPT,   argChar, __ &TabChar, "TABchar (field delimiter)",
X     'r', ARGNOVAL, argMine, __ NULL,     "raw (trigger raw-mode \
X  before processing any more arguments on the command-line)",
X  
X--- 124,130 ----
X     'y', ARGOPT, argUBool, __ &YFlag, "Yflag (unset Y flag)",
X     'z', ARGOPT, argTBool, __ &ZFlag, "Zflag (toggle Z flag)",
X  
X!    't', ARGOPT,   argChar, __ &TabChar, "TAB=char (field delimiter)",
X     'r', ARGNOVAL, argMine, __ NULL,     "raw (trigger raw-mode \
X  before processing any more arguments on the command-line)",
X  
X***************
X*** 143,149 ****
X     'n', ARGREQ|ARGPOS, argStr,  __ &Name,  "name (name to look for)",
X     's', ARGVALOPT, argStr,  __ &Str,       "STRing (optional string to use)",
X     'g', ARGVEC,    argStr,  __ &Groups,    "newsGROUPS (newsgroups to test)",
X!    'c', ARGOPT,    argInt,  __ &RepCount,  "REPcount (repeat count per group)",
X     'd', ARGOPT,    argStr,   __ &DirName,  "DIRname (work directory)",
X     'i', ARGVEC,    argInt,   __ &Integers, "INTegerS (vector of numbers)",
X     '#', ARGHIDDEN, argBool,  __ &XRated,   "XratedMODE (naughty! naughty!)",
X--- 143,149 ----
X     'n', ARGREQ|ARGPOS, argStr,  __ &Name,  "name (name to look for)",
X     's', ARGVALOPT, argStr,  __ &Str,       "STRing (optional string to use)",
X     'g', ARGVEC,    argStr,  __ &Groups,    "newsGROUPS (newsgroups to test)",
X!    'c', ARGOPT,    argInt,  __ &RepCount,  "REP=count (repeat count per group)",
X     'd', ARGOPT,    argStr,   __ &DirName,  "DIRname (work directory)",
X     'i', ARGVEC,    argInt,   __ &Integers, "INTegerS (vector of numbers)",
X     '#', ARGHIDDEN, argBool,  __ &XRated,   "XratedMODE (naughty! naughty!)",
X***************
X*** 152,158 ****
X     'y', ARGOPT, argUBool, __ &YFlag, "Yflag (unset Y flag)",
X     'z', ARGOPT, argTBool, __ &ZFlag, "Zflag (toggle Z flag)",
X  
X!    't', ARGOPT,   argChar, __ &TabChar, "TABchar (field delimiter)",
X     'r', ARGNOVAL, argMine, __ NULL,     "raw (trigger raw-mode \
X  before processing any more arguments on the command-line)",
X  
X--- 152,158 ----
X     'y', ARGOPT, argUBool, __ &YFlag, "Yflag (unset Y flag)",
X     'z', ARGOPT, argTBool, __ &ZFlag, "Zflag (toggle Z flag)",
X  
X!    't', ARGOPT,   argChar, __ &TabChar, "TAB=char (field delimiter)",
X     'r', ARGNOVAL, argMine, __ NULL,     "raw (trigger raw-mode \
X  before processing any more arguments on the command-line)",
X  
X***************
X*** 258,264 ****
X     printf( "XRated=%d, Raw-Mode = \"%s\"\n", XRated, Mode );
X  
X        /* to call parsecntl() to see if the optional value was supplied */
X!    (VOID) parsecntl( (ARGDESC *)argd, pc_ARGFLAGS, pc_READ, "string", &flags);
X  
X     if ( BTEST(flags, ARGGIVEN) && !BTEST(flags, ARGVALGIVEN) ) {
X        printf("String=!No Value Given on CmdLine!\n" );
X--- 258,264 ----
X     printf( "XRated=%d, Raw-Mode = \"%s\"\n", XRated, Mode );
X  
X        /* to call parsecntl() to see if the optional value was supplied */
X!    i = parsecntl( (ARGDESC *)argd, pc_ARGFLAGS, pc_READ, "string", &flags);
X  
X     if ( BTEST(flags, ARGGIVEN) && !BTEST(flags, ARGVALGIVEN) ) {
X        printf("String=!No Value Given on CmdLine!\n" );
X*** strfuncs.c.OLD	Mon Jun  3 11:17:52 1991
X--- strfuncs.c	Wed May 15 14:33:16 1991
X***************
X*** 23,30 ****
X  **       strtrim() -- trim leading and trailing characters in a string
X  **       strsplit() -- split a string up into a vector of tokens
X  **       strjoin() -- join a vector of tokens into a single string
X! **       get_name() -- return the aname (argument-name) of an argument
X! **       get_keyword() -- return the sname (keyword-name) of an argument
X  **       match() -- match two keywords (case insensitive) upto a unique prefix
X  **       basename() -- remove the leading directories (and disks) from a path
X  **       indent_para() -- print an indented hanging paragraph
X--- 23,30 ----
X  **       strtrim() -- trim leading and trailing characters in a string
X  **       strsplit() -- split a string up into a vector of tokens
X  **       strjoin() -- join a vector of tokens into a single string
X! **       get_argname() -- return the aname (argument-name) of an argument
X! **       get_kwdname() -- return the sname (keyword-name) of an argument
X  **       match() -- match two keywords (case insensitive) upto a unique prefix
X  **       basename() -- remove the leading directories (and disks) from a path
X  **       indent_para() -- print an indented hanging paragraph
X***************
X*** 47,57 ****
X  
X  static CONST char WhiteSpace[] = " \t\n\r\v\f";
X  
X! 
X  #if ( defined(unix_style)  ||  defined(ibm_style) )
X  # define  TO_KWDCASE(c)  TOLOWER(c)
X  #else
X  # define  TO_KWDCASE(c)  TOUPPER(c)
X  #endif
X  
X  
X--- 47,59 ----
X  
X  static CONST char WhiteSpace[] = " \t\n\r\v\f";
X  
X! #define c_ARG_SEP '='
X  #if ( defined(unix_style)  ||  defined(ibm_style) )
X  # define  TO_KWDCASE(c)  TOLOWER(c)
X+ # define  KWDCASECOPY(dest,src)  strlcpy(dest,src)
X  #else
X  # define  TO_KWDCASE(c)  TOUPPER(c)
X+ # define  KWDCASECOPY(dest,src)  strucpy(dest,src)
X  #endif
X  
X  
X***************
X*** 746,757 ****
X  
X  
X  /***************************************************************************
X! ** ^FUNCTION: get_name - return the aname (argument-name) of an argument
X  **
X  ** ^SYNOPSIS:
X  */
X  #ifndef __ANSI_C__
X!    char  *get_name( s, buf )
X  /*
X  ** ^PARAMETERS:
X  */
X--- 748,759 ----
X  
X  
X  /***************************************************************************
X! ** ^FUNCTION: get_argname - return the aname (argument-name) of an argument
X  **
X  ** ^SYNOPSIS:
X  */
X  #ifndef __ANSI_C__
X!    char  *get_argname( s, buf )
X  /*
X  ** ^PARAMETERS:
X  */
X***************
X*** 764,770 ****
X  #endif  /* !__ANSI_C__ */
X  
X  /* ^DESCRIPTION:
X! **    Get_name will get the full argument name of the given argument
X  **    (not just the keyword name) and copy it to buf.
X  **
X  ** ^REQUIREMENTS:
X--- 766,772 ----
X  #endif  /* !__ANSI_C__ */
X  
X  /* ^DESCRIPTION:
X! **    Get_argname will get the full argument name of the given argument
X  **    (not just the keyword name) and copy it to buf.
X  **
X  ** ^REQUIREMENTS:
X***************
X*** 782,803 ****
X  **    and copy the result in the given buffer
X  ***^^**********************************************************************/
X  #ifdef __ANSI_C__
X!    char *get_name( const char *s, char *buf )
X  #endif
X  {
X!       /* <buf> must be large enough to hold the result! */
X!    strlcpy(buf, s);
X     return   buf;
X  }
X  
X  
X  /***************************************************************************
X! ** ^FUNCTION: get_keyword - get the sname (keyword name) of an argument
X  **
X  ** ^SYNOPSIS:
X  */
X  #ifndef __ANSI_C__
X!    char  *get_keyword( s, buf )
X  /*
X  ** ^PARAMETERS:
X  */
X--- 784,815 ----
X  **    and copy the result in the given buffer
X  ***^^**********************************************************************/
X  #ifdef __ANSI_C__
X!    char *get_argname( const char *s, char *buf )
X  #endif
X  {
X!    register CONST char *p1 = s, *p2;
X! 
X!       /* see if sname and aname are separated by c_ARG_SEP
X!       ** <buf> must be large enough to hold the result!
X!       */
X!    p2 = strchr( p1, c_ARG_SEP );
X!    if ( p2 ) {
X!       strlcpy( buf, ++p2 );
X!    }
X!    else {
X!       strlcpy(buf, s);
X!    }
X     return   buf;
X  }
X  
X  
X  /***************************************************************************
X! ** ^FUNCTION: get_kwdname - get the sname (keyword name) of an argument
X  **
X  ** ^SYNOPSIS:
X  */
X  #ifndef __ANSI_C__
X!    char  *get_kwdname( s, buf )
X  /*
X  ** ^PARAMETERS:
X  */
X***************
X*** 810,816 ****
X  #endif  /* !__ANSI_C__ */
X  
X  /* ^DESCRIPTION:
X! **    Get_name will get the keyword name of the given argument
X  **    (not the entire argument name) and copy it to buf.
X  **
X  **    The sname (keyword-name) consists only of all uppercase characters
X--- 822,828 ----
X  #endif  /* !__ANSI_C__ */
X  
X  /* ^DESCRIPTION:
X! **    Get_kwdname will get the keyword name of the given argument
X  **    (not the entire argument name) and copy it to buf.
X  **
X  **    The sname (keyword-name) consists only of all uppercase characters
X***************
X*** 833,877 ****
X  **    and copy the result in the given buffer
X  ***^^**********************************************************************/
X  #ifdef __ANSI_C__
X!    char *get_keyword( const char *s, char *buf )
X  #endif
X  {
X!    register char *p1 = (char *)s, *p2;
X!    register int   i, len = 0;
X!    char *caps = CHARNULL;
X  
X     if ( !p1 )  return  CHARNULL;
X  
X!       /* find size to copy (use all caps if possible) */
X!    for ( p1 = (char *)s ; *p1 ; p1++ )   {
X!      if ( !caps  &&  isupper( *p1 ) )  caps = p1;
X!          if ( caps   &&   isupper( *p1 ) )   ++len;
X     }
X-    if ( !caps )   len = (int) (p1 - (char *)s);
X  
X        /* copy string into buffer and convert it to desired case */
X        /* <buf> must be large enough to hold the result! */
X!    p1 = buf;
X!    if ( len )   {
X!      if ( !caps ) {
X!         for ( p1 = buf, p2 = (char *)s, i = 0 ; i < len ; p1++, p2++, i++ ) {
X!             *p1 = TO_KWDCASE(*p2);
X!         }
X!      }/*if*/
X  
X-      else {
X-         for ( p2 = caps, i = 0 ; i < len ; p2++ ) {
X-            if ( isupper( *p2 ) )   {
X-               *(p1++) = TO_KWDCASE(*p2);
X-               ++i;
X-            }
X-         }/*for*/
X-      }/*else*/
X-    }/*if*/
X-    *p1 = '\0';
X- 
X     return   buf;   /* return buffer address */
X  }
X  #ifndef amiga_style
X  
X  /***************************************************************************
X--- 845,887 ----
X  **    and copy the result in the given buffer
X  ***^^**********************************************************************/
X  #ifdef __ANSI_C__
X!    char *get_kwdname( const char *s, char *buf )
X  #endif
X  {
X!    register char *p1 = (char *)s, *p2, ch;
X!    BOOL caps = FALSE;
X  
X     if ( !p1 )  return  CHARNULL;
X  
X!       /* see if sname and aname are separated by c_ARG_SEP */
X!    p2 = strchr( p1, c_ARG_SEP );
X!    if ( p2 ) {
X!       ch = *p2;
X!       *p2 = '\0';
X!       KWDCASECOPY( buf, p1 );
X!       *p2 = ch;
X!       return  buf;
X     }
X  
X        /* copy string into buffer and convert it to desired case */
X        /* <buf> must be large enough to hold the result! */
X!    for ( p2 = buf; *p1 ; p1++ ) {
X!       if ( isupper(*p1) ) {
X!          if ( !caps ) {
X!             caps = TRUE;
X!             p2 = buf;
X!          }
X!          *p2++ = TO_KWDCASE(*p1);
X!       }
X!       else if ( !caps ) {
X!          *p2++ = TO_KWDCASE(*p1);
X!       }
X!    }
X!    *p2 = '\0';
X  
X     return   buf;   /* return buffer address */
X  }
X+ 
X  #ifndef amiga_style
X  
X  /***************************************************************************
X***************
X*** 928,945 ****
X  #endif
X  {
X     int  i, clen, tlen, too_short=0;
X!    CONST char *full_targ;
X!    char *up_targ;
X  
X  
X!    full_targ = target;
X  
X-       /* make up_targ the uppercase portion of target */
X-    up_targ = strdup( full_targ );
X-    (VOID) get_keyword( full_targ, up_targ );
X- 
X        /* match at least MINLEN characters if possible */
X!    tlen = strlen( up_targ );
X     clen = strlen( candidate );
X     if ( (tlen >= MINLEN)   &&   (clen < MINLEN) ) {
X        ++too_short;      /* not long enough -- no match */
X--- 938,951 ----
X  #endif
X  {
X     int  i, clen, tlen, too_short=0;
X!    char  arg_targ[ 256 ], kwd_targ[ 256 ];
X  
X  
X!       /* make kwd_targ the keyword portion of target */
X!    (VOID) get_kwdname( target, kwd_targ );
X  
X        /* match at least MINLEN characters if possible */
X!    tlen = strlen( kwd_targ );
X     clen = strlen( candidate );
X     if ( (tlen >= MINLEN)   &&   (clen < MINLEN) ) {
X        ++too_short;      /* not long enough -- no match */
X***************
X*** 947,953 ****
X  
X  #ifdef vms_style
X        /* if first two chars are NO then match at least MINLEN+2 chars */
X!    if ( !strnicmp(up_targ, "NO", 2) ) {
X        if ( (tlen >= (MINLEN + 2))   &&   (clen < (MINLEN + 2)) ) {
X           ++too_short;      /* not long enough -- no match */
X        }
X--- 953,959 ----
X  
X  #ifdef vms_style
X        /* if first two chars are NO then match at least MINLEN+2 chars */
X!    if ( !strnicmp(kwd_targ, "NO", 2) ) {
X        if ( (tlen >= (MINLEN + 2))   &&   (clen < (MINLEN + 2)) ) {
X           ++too_short;      /* not long enough -- no match */
X        }
X***************
X*** 954,971 ****
X     }
X  #endif
X  
X!       /* first try to match prefix of the uppercase portion */
X!    i = (too_short) ? -1 : strnicmp(up_targ, candidate, clen);
X  
X-    free( up_targ );
X- 
X        /* did we match? */
X     if ( !i )  return  0;   /* yes! */
X  
X!    /* no! : compare the whole target
X     **       match at least MINLEN characters if possible
X     */
X!    tlen = strlen(full_targ);
X     if ( (tlen >= MINLEN)   &&   (clen < MINLEN) ) {
X        return   -1;      /* not long enough -- no match */
X     }
X--- 960,978 ----
X     }
X  #endif
X  
X!       /* first try to match prefix of the keyword portion */
X!    i = (too_short) ? -1 : strnicmp(kwd_targ, candidate, clen);
X  
X        /* did we match? */
X     if ( !i )  return  0;   /* yes! */
X  
X!    /* no! : compare the argument portion
X     **       match at least MINLEN characters if possible
X     */
X!       /* make arg_targ the argument portion of target */
X!    (VOID) get_argname( target, arg_targ );
X! 
X!    tlen = strlen(arg_targ);
X     if ( (tlen >= MINLEN)   &&   (clen < MINLEN) ) {
X        return   -1;      /* not long enough -- no match */
X     }
X***************
X*** 972,978 ****
X  
X  #ifdef vms_style
X     /* if first two chars are NO then match at least MINLEN+2 chars */
X!    if ( !strnicmp(full_targ, "no", 2) ) {
X        if ( (tlen >= (MINLEN + 2))   &&   (clen < (MINLEN + 2)) ) {
X           return   -1;      /* not long enough -- no match */
X        }
X--- 979,985 ----
X  
X  #ifdef vms_style
X     /* if first two chars are NO then match at least MINLEN+2 chars */
X!    if ( !strnicmp(arg_targ, "no", 2) ) {
X        if ( (tlen >= (MINLEN + 2))   &&   (clen < (MINLEN + 2)) ) {
X           return   -1;      /* not long enough -- no match */
X        }
X***************
X*** 979,985 ****
X     }
X  #endif
X  
X!    return   strnicmp(full_targ, candidate, clen);
X  }
X  
X  
X--- 986,992 ----
X     }
X  #endif
X  
X!    return  strnicmp(arg_targ, candidate, clen);
X  }
X  
X  
X***************
X*** 992,1014 ****
X     int match( candidate, target) char *candidate, *target;
X  # endif
X  {
X!    int i, j;
X!    char c;
X  
X!    i = j = 0;
X  
X!    while ( isgraph(target[i]) || isgraph(candidate[i]) ) {
X!       while ( islower(target[i]) ) i++;
X!       if ( !isgraph(target[i]) ) {
X!          if ( !isgraph(candidate[j]) )  return 0;
X!          return  stricmp(target, candidate);
X!       }
X!       c = islower( candidate[j] ) ? toupper(candidate[j]) : candidate[j];
X!       if (target[i] != c)  return  stricmp(target, candidate);
X!       i++;
X!       j++;
X!    }
X!    return 0;
X  }
X  
X  #endif
X--- 999,1016 ----
X     int match( candidate, target) char *candidate, *target;
X  # endif
X  {
X!    char kwd_targ[ 256 ], arg_targ[ 256 ];
X!    int rc;
X  
X!    (VOID) get_kwdname( target, kwd_targ );
X!    rc = stricmp( kwd_targ, candidate );
X  
X!    if ( rc == 0 )  return  0;
X! 
X!    (VOID) get_argname( target, arg_targ );
X!    rc = stricmp( arg_targ, candidate );
X! 
X!    return  rc;
X  }
X  
X  #endif
X*** strfuncs.h.OLD	Mon Jun  3 11:18:00 1991
X--- strfuncs.h	Mon May 13 13:59:31 1991
X***************
X*** 33,40 ****
X  EXTERN  int    strsplit     ARGS(( char ***, char *, const char * ));
X  EXTERN  char  *strjoin      ARGS(( const char **, const char * ));
X  
X! EXTERN  char  *get_name     ARGS(( const char *, char * ));
X! EXTERN  char  *get_keyword  ARGS(( const char *, char * ));
X  EXTERN  int    match        ARGS(( const char *, const char * ));
X  EXTERN  char  *basename     ARGS(( char * ));
X  EXTERN  VOID   indent_para  ARGS(( FILE *, int, int,
X--- 33,40 ----
X  EXTERN  int    strsplit     ARGS(( char ***, char *, const char * ));
X  EXTERN  char  *strjoin      ARGS(( const char **, const char * ));
X  
X! EXTERN  char  *get_argname  ARGS(( const char *, char * ));
X! EXTERN  char  *get_kwdname  ARGS(( const char *, char * ));
X  EXTERN  int    match        ARGS(( const char *, const char * ));
X  EXTERN  char  *basename     ARGS(( char * ));
X  EXTERN  VOID   indent_para  ARGS(( FILE *, int, int,
X*** unix_args.c.OLD	Mon Jun  3 11:18:42 1991
X--- unix_args.c	Mon May 13 13:44:30 1991
X***************
X*** 215,221 ****
X                    BSET( arg_flags(ad), ARGGIVEN );
X                 }
X                 else {
X!                   (VOID) get_keyword( arg_sname(ad), name );
X                    usrerr("option %c%s requires an argument", c_KWD_PFX, name);
X                    arg_flags(ad) = flags;
X                    parse_error = pe_SYNTAX;
X--- 215,221 ----
X                    BSET( arg_flags(ad), ARGGIVEN );
X                 }
X                 else {
X!                   (VOID) get_kwdname( arg_sname(ad), name );
X                    usrerr("option %c%s requires an argument", c_KWD_PFX, name);
X                    arg_flags(ad) = flags;
X                    parse_error = pe_SYNTAX;
X***************
X*** 339,345 ****
X                       BSET( arg_flags(ad), ARGGIVEN );
X                    }
X                    else {
X!                      (VOID) get_name(arg_sname(ad), name);
X                       usrerr( "%s required for %c%c flag",
X                               name, c_OPT_PFX, arg_cname(ad) );
X                       arg_flags(ad) = flags;
X--- 339,345 ----
X                       BSET( arg_flags(ad), ARGGIVEN );
X                    }
X                    else {
X!                      (VOID) get_argname(arg_sname(ad), name);
X                       usrerr( "%s required for %c%c flag",
X                               name, c_OPT_PFX, arg_cname(ad) );
X                       arg_flags(ad) = flags;
X***************
X*** 505,517 ****
X     char *pos;
X     argName_t   name, keyword;
X  
X!    (VOID) get_name( arg_sname(ad), name );
X  
X     if (ARG_isPOSITIONAL(ad)) {
X        sprintf( buf, "<%s>", name );
X     }
X     else {
X!       (VOID) get_keyword( arg_sname(ad), keyword );
X  
X        if ( isupper(arg_cname(ad))  &&  toupper(*keyword) == arg_cname(ad) ) {
X           *keyword = toupper(*keyword);
X--- 505,517 ----
X     char *pos;
X     argName_t   name, keyword;
X  
X!    (VOID) get_argname( arg_sname(ad), name );
X  
X     if (ARG_isPOSITIONAL(ad)) {
X        sprintf( buf, "<%s>", name );
X     }
X     else {
X!       (VOID) get_kwdname( arg_sname(ad), keyword );
X  
X        if ( isupper(arg_cname(ad))  &&  toupper(*keyword) == arg_cname(ad) ) {
X           *keyword = toupper(*keyword);
X*** unix_man.c.OLD	Mon Jun  3 11:18:48 1991
X--- unix_man.c	Mon May 13 13:44:31 1991
X***************
X*** 75,81 ****
X     char *pos;
X     argName_t   name;
X  
X!    (VOID) get_name( arg_sname(ad), name );
X  
X     if (ARG_isPOSITIONAL(ad)) {
X         if ( ARG_isMULTIVAL(ad) ) {
X--- 75,81 ----
X     char *pos;
X     argName_t   name;
X  
X!    (VOID) get_argname( arg_sname(ad), name );
X  
X     if (ARG_isPOSITIONAL(ad)) {
X         if ( ARG_isMULTIVAL(ad) ) {
X***************
X*** 87,93 ****
X--- 87,97 ----
X         return  strlen(name);
X     }/*if parm*/
X  
X+ #ifdef SVR4
X+    sprintf(buf, "\\f4\\-%c\\fP", arg_cname(ad));
X+ #else
X     sprintf(buf, "\\fB\\-%c\\fP", arg_cname(ad));
X+ #endif
X     pos = buf + strlen(buf);
X  
X     if ( ARG_isVALTAKEN(ad)  &&  !ARG_isBOOLEAN(ad)  &&  !ARG_isPSEUDOARG(ad) ) {
X***************
X*** 185,191 ****
X--- 189,199 ----
X     printf(".if n .ll 78\n");
X  
X     COMMENT;
X+ #ifdef SVR4
X+    TH( name, 1 );
X+ #else
X     TH( strupr(name), 1 );
X+ #endif
X  
X     COMMENT;
X     SH( "NAME" );
X***************
X*** 195,201 ****
X--- 203,213 ----
X     SH( "SYNOPSIS" );
X  
X     len = strlen( program ) + 1;
X+ #ifdef SVR4
X+    sprintf( name, "\\f4%s\\fP", program );
X+ #else
X     sprintf( name, "\\fB%s\\fP", program );
X+ #endif
X     TP( len, name );
X  
X     maxlen = 0;
X*** useful.h.OLD	Mon Jun  3 11:18:52 1991
X--- useful.h	Thu May 16 16:21:26 1991
X***************
X*** 31,36 ****
X--- 31,42 ----
X  # endif
X  #endif /* _unix */
X  
X+ #if (defined(_UNIX) || defined(__UNIX) || defined(_UNIX_) || defined(__UNIX__))
X+ # ifndef unix
X+ #   define unix
X+ # endif
X+ #endif /* _UNIX */
X+ 
X     /* give a stab at the dual Unix universe dilemma (UCB vs AT&T) */
X  #ifdef unix
X  # if ( defined(_BSD) && !defined(BSD) )
X***************
X*** 84,102 ****
X  #endif /* unix */
X  
X  #ifndef MSDOS
X! # if ( defined(_MSDOS_) || defined(__MSDOS__) || defined(_MSDOS) )
X  #  define MSDOS
X  # endif
X  #endif
X  
X  #ifndef OS2
X! # if ( defined(_OS2_) || defined(__OS2__) || defined(_OS2) )
X  #  define OS2
X  # endif
X  #endif
X  
X  #ifndef AmigaDOS
X! # if ( defined(MANX) || defined(AZTEC) )
X  #   define AmigaDOS
X  # endif
X  #endif /* AmigaDOS */
X--- 90,108 ----
X  #endif /* unix */
X  
X  #ifndef MSDOS
X! # if (defined(_MSDOS_)||defined(__MSDOS__)||defined(_MSDOS)||defined(__MSDOS))
X  #  define MSDOS
X  # endif
X  #endif
X  
X  #ifndef OS2
X! # if ( defined(_OS2_) || defined(__OS2__) || defined(_OS2) || defined(__OS2) )
X  #  define OS2
X  # endif
X  #endif
X  
X  #ifndef AmigaDOS
X! # if ( defined(AMIGA) || defined(MANX) || defined(AZTEC) )
X  #   define AmigaDOS
X  # endif
X  #endif /* AmigaDOS */
X***************
X*** 303,312 ****
X  # endif  /* !_SIZE_T_DEFINED */
X  #endif
X  
X! #ifndef __malloc_h
X!  EXTERN  ARBPTR  malloc   ARGS(( size_t ));
X!  EXTERN  ARBPTR  realloc  ARGS(( ARBPTR, size_t ));
X!  EXTERN  VOID    free     ARGS(( ARBPTR ));
X  #endif /*__malloc_h*/
X  
X  EXTERN  ARBPTR  ckalloc  ARGS(( size_t ));
X--- 309,316 ----
X  # endif  /* !_SIZE_T_DEFINED */
X  #endif
X  
X! #if ( !defined(__malloc_h) && !defined(__MALLOC_H) )
X! # include <malloc.h>
X  #endif /*__malloc_h*/
X  
X  EXTERN  ARBPTR  ckalloc  ARGS(( size_t ));
X*** vms_args.c.OLD	Mon Jun  3 11:18:57 1991
X--- vms_args.c	Mon May 13 13:44:32 1991
X***************
X*** 683,689 ****
X                 BSET( arg_flags(ad), ARGVALGIVEN );
X              }
X              else {
X!                (VOID) get_keyword( arg_sname(ad), keyword );
X                 usrerr("qualifier %s requires an argument", keyword);
X                 arg_flags(ad) = flags;
X                 parse_error = pe_SYNTAX;
X--- 683,689 ----
X                 BSET( arg_flags(ad), ARGVALGIVEN );
X              }
X              else {
X!                (VOID) get_kwdname( arg_sname(ad), keyword );
X                 usrerr("qualifier %s requires an argument", keyword);
X                 arg_flags(ad) = flags;
X                 parse_error = pe_SYNTAX;
X***************
X*** 849,861 ****
X     char * pos;
X     argName_t  keyword, name;
X  
X!    (VOID) get_name( arg_sname(ad), name );
X  
X     if (ARG_isPOSITIONAL(ad)) {
X        sprintf( buf, "<%s>", name );
X     }
X     else {
X!       (VOID) get_keyword( arg_sname(ad), keyword );
X        sprintf( buf, "%c%s", *s_KWD_PFX, keyword );
X        pos = buf + strlen(buf);
X  
X--- 849,861 ----
X     char * pos;
X     argName_t  keyword, name;
X  
X!    (VOID) get_argname( arg_sname(ad), name );
X  
X     if (ARG_isPOSITIONAL(ad)) {
X        sprintf( buf, "<%s>", name );
X     }
X     else {
X!       (VOID) get_kwdname( arg_sname(ad), keyword );
X        sprintf( buf, "%c%s", *s_KWD_PFX, keyword );
X        pos = buf + strlen(buf);
X  
X***************
X*** 965,971 ****
X  
X  
X              if ( ARG_isMULTIVAL(ad) ) {
X!                (VOID) get_name( arg_sname(ad), name );
X                 strcat(buf, "[,<");
X                 strcat(buf, name);
X                 strcat(buf, ">...]");
X--- 965,971 ----
X  
X  
X              if ( ARG_isMULTIVAL(ad) ) {
X!                (VOID) get_argname( arg_sname(ad), name );
X                 strcat(buf, "[,<");
X                 strcat(buf, name);
X                 strcat(buf, ">...]");
X*** xparse.c.OLD	Mon Jun  3 11:19:13 1991
X--- xparse.c	Mon Jun  3 10:29:49 1991
X***************
X*** 857,872 ****
X           if ( ARG_isREQUIRED(ad)  &&  !ARG_isGIVEN(ad) ) {
X                 /* still didn't get a value... sigh */
X              if ( ARG_isPOSITIONAL(ad) ) {
X!                (VOID) get_name( arg_sname(ad), s );
X                 usrerr("%s required", s);
X              }
X              else {
X  #ifdef amiga_style
X!                (VOID) get_keyword( arg_sname(ad), s );
X                 usrerr("argument required for %s keyword", s);
X  #endif
X  #ifdef ibm_style
X!                (VOID) get_name( arg_sname(ad), s );
X                 {
X                    char c, *pfx = getenv( "SWITCHAR" );
X                    c = ( pfx &&  *pfx ) ? *pfx : '/';
X--- 857,872 ----
X           if ( ARG_isREQUIRED(ad)  &&  !ARG_isGIVEN(ad) ) {
X                 /* still didn't get a value... sigh */
X              if ( ARG_isPOSITIONAL(ad) ) {
X!                (VOID) get_argname( arg_sname(ad), s );
X                 usrerr("%s required", s);
X              }
X              else {
X  #ifdef amiga_style
X!                (VOID) get_kwdname( arg_sname(ad), s );
X                 usrerr("argument required for %s keyword", s);
X  #endif
X  #ifdef ibm_style
X!                (VOID) get_argname( arg_sname(ad), s );
X                 {
X                    char c, *pfx = getenv( "SWITCHAR" );
X                    c = ( pfx &&  *pfx ) ? *pfx : '/';
X***************
X*** 874,884 ****
X                 }
X  #endif
X  #ifdef unix_style
X!                (VOID) get_name( arg_sname(ad), s );
X                 usrerr("%s required for %c%c flag", s, c_OPT_PFX, arg_cname(ad));
X  #endif
X  #ifdef vms_style
X!                (VOID) get_keyword( arg_sname(ad), s );
X                 usrerr("value required for %c%s qualifier", *s_KWD_PFX, s);
X  #endif
X              }
X--- 874,884 ----
X                 }
X  #endif
X  #ifdef unix_style
X!                (VOID) get_argname( arg_sname(ad), s );
X                 usrerr("%s required for %c%c flag", s, c_OPT_PFX, arg_cname(ad));
X  #endif
X  #ifdef vms_style
X!                (VOID) get_kwdname( arg_sname(ad), s );
X                 usrerr("value required for %c%s qualifier", *s_KWD_PFX, s);
X  #endif
X              }
X***************
X*** 1689,1701 ****
X              int  *argflags;
X              BOOL  is_match = FALSE;
X  
X!             for (args = argd; !is_match  &&  args; args = cmd_defargs(argd) ) {
X!                for (ad = ARG_FIRST(args); !ARG_isEND(ad); ARG_ADVANCE(ad) ) {
X!                   if (arg_type(ad) == argDummy)   continue;
X                    if ( match(name, arg_sname(ad)) == 0 ) {
X                       is_match = TRUE;
X                       break;
X!                   }
X                 }/*foreach arg*/
X              }/*foreach argdesc*/
X  
X--- 1689,1702 ----
X              int  *argflags;
X              BOOL  is_match = FALSE;
X  
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                    if ( match(name, arg_sname(ad)) == 0 ) {
X                       is_match = TRUE;
X                       break;
X!                   }/*if*/
X                 }/*foreach arg*/
X              }/*foreach argdesc*/
X  
END_OF_FILE
  if test 50339 -ne `wc -c <'PATCH'`; then
    echo shar: \"'PATCH'\" unpacked with wrong size!
  fi
  # end of 'PATCH'
fi
echo shar: End of archive.
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