home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume20 / parseargs / patch06 / PATCH
Encoding:
Text File  |  1991-06-08  |  49.2 KB  |  1,533 lines

  1. *** Intro.OLD    Mon Jun  3 11:13:52 1991
  2. --- Intro    Wed May 22 14:47:07 1991
  3. ***************
  4. *** 83,89 ****
  5.   
  6.    And before you know it, your command-line had been parsed, all variables 
  7.    have been assigned their corresponding values from the command-line, syntax
  8. !  has been verified, and a usage message (if required) has been printed. 
  9.   
  10.    Under UNIX, the command-line syntax (using single character options) for the
  11.    above command would be:
  12. --- 83,89 ----
  13.   
  14.    And before you know it, your command-line had been parsed, all variables 
  15.    have been assigned their corresponding values from the command-line, syntax
  16. !  have been verified, and a usage message (if required) has been printed. 
  17.   
  18.    Under UNIX, the command-line syntax (using single character options) for the
  19.    above command would be:
  20. ***************
  21. *** 108,114 ****
  22.       cmdname [/a[=<areacode>]] [/g=<newsgroups>...] [/r=<repcount>]
  23.               [/s=<sepchar>] [/x]  <name>  [<args>...]
  24.   
  25. !   The AmigaDOS command-line syntax would be the following:
  26.   
  27.       cmdname [AREA [<areacode>]] [GROUPS <newsgroups>...] [REP <repcount>]
  28.               [SEP <sepchar>] [X]  <name>  [<args>...]
  29. --- 108,114 ----
  30.       cmdname [/a[=<areacode>]] [/g=<newsgroups>...] [/r=<repcount>]
  31.               [/s=<sepchar>] [/x]  <name>  [<args>...]
  32.   
  33. !  The AmigaDOS command-line syntax would be the following:
  34.   
  35.       cmdname [AREA [<areacode>]] [GROUPS <newsgroups>...] [REP <repcount>]
  36.               [SEP <sepchar>] [X]  <name>  [<args>...]
  37. *** README.OLD    Mon Jun  3 11:14:12 1991
  38. --- README    Wed May 22 14:56:09 1991
  39. ***************
  40. *** 290,295 ****
  41. --- 290,296 ----
  42.    I also added the capability to handle ARGVEC arguments into the
  43.    remaining argument type functions.
  44.   
  45.    NEW ARGUMENT FLAGS:
  46.    ===================
  47.    I added the following argument flags to parseargs:
  48. ***************
  49. *** 306,311 ****
  50. --- 307,313 ----
  51.   
  52.    Consult the manual page for parseargs(1) & parseargs(3) for more information.
  53.   
  54.    NEW INTERFACE
  55.    =============
  56.    I added a set of Macros to allow a more "self documenting" approach to
  57. ***************
  58. *** 336,341 ****
  59. --- 338,344 ----
  60.    variable.  See the parseargs(3) and parseargs(1) manual pages for more
  61.    information regarding USAGECNTL.
  62.   
  63.    SPECIFYING ALTERNATE PARSING BEHAVIOR
  64.    =====================================
  65.    Parseargs provides 3 methods for controlling "how" the command-line is
  66. ***************
  67. *** 351,356 ****
  68. --- 354,360 ----
  69.    See the manual pages for parseargs(1), parseargs(3), and parsecntl(3)
  70.    for more information.
  71.   
  72.    GIVING DEFAULT ARGUMENTS
  73.    ========================
  74.    Programs that use parseargs may be given default arguments under UNIX
  75. ***************
  76. *** 379,389 ****
  77.    relatively easy to add new shell-types. At this point in time, parseargs
  78.    will generate output for the following command-interpreters:
  79.   
  80. !      sh           (Bourne Shell)
  81. !      csh/tcsh     (C-Shell)
  82. !      bash         (Bourne-Again Shell)
  83. !      ksh          (Korn Shell)
  84. !      rc           (Plan 9 Shell)
  85.        perl
  86.        awk
  87.   
  88. --- 383,394 ----
  89.    relatively easy to add new shell-types. At this point in time, parseargs
  90.    will generate output for the following command-interpreters:
  91.   
  92. !      sh               (Bourne Shell)
  93. !      csh/tcsh/itcsh   (C-Shell)
  94. !      bash             (Bourne-Again Shell)
  95. !      ksh              (Korn Shell)
  96. !      rc               (Plan 9 Shell)
  97. !      zsh              (Z shell)
  98.        perl
  99.        awk
  100.   
  101. *** amiga_args.c.OLD    Mon Jun  3 11:14:17 1991
  102. --- amiga_args.c    Mon May 13 13:44:24 1991
  103. ***************
  104. *** 144,150 ****
  105.                  BSET( arg_flags(cmd_prev(cmd)), ARGGIVEN );
  106.               }
  107.               else {  /* value was required */
  108. !                (VOID)get_keyword( arg_sname(cmd_prev(cmd)), keyword );
  109.                  usrerr( "value required for %s keyword", keyword );
  110.                  parse_error = pe_SYNTAX;
  111.               }
  112. --- 144,150 ----
  113.                  BSET( arg_flags(cmd_prev(cmd)), ARGGIVEN );
  114.               }
  115.               else {  /* value was required */
  116. !                (VOID)get_kwdname( arg_sname(cmd_prev(cmd)), keyword );
  117.                  usrerr( "value required for %s keyword", keyword );
  118.                  parse_error = pe_SYNTAX;
  119.               }
  120. ***************
  121. *** 310,316 ****
  122.            BSET( arg_flags(cmd_prev(cmd)), ARGGIVEN );
  123.         }
  124.         else {  /* value was required */
  125. !          (VOID)get_keyword( arg_sname(cmd_prev(cmd)), keyword );
  126.            usrerr( "value required for %s keyword", keyword );
  127.            parse_error = pe_SYNTAX;
  128.         }
  129. --- 310,316 ----
  130.            BSET( arg_flags(cmd_prev(cmd)), ARGGIVEN );
  131.         }
  132.         else {  /* value was required */
  133. !          (VOID)get_kwdname( arg_sname(cmd_prev(cmd)), keyword );
  134.            usrerr( "value required for %s keyword", keyword );
  135.            parse_error = pe_SYNTAX;
  136.         }
  137. ***************
  138. *** 366,378 ****
  139.      char * pos;
  140.      argName_t  keyword, name;
  141.   
  142. !    (VOID) get_name(arg_sname(ad), name);
  143.   
  144.      if ( ARG_isPOSITIONAL(ad) ) {
  145.         sprintf( buf, "<%s>", name );
  146.      }
  147.      else {
  148. !       (VOID) get_keyword(arg_sname(ad), keyword);
  149.         (VOID) strcpy( buf, keyword );
  150.         pos = buf + strlen(buf);
  151.   
  152. --- 366,378 ----
  153.      char * pos;
  154.      argName_t  keyword, name;
  155.   
  156. !    (VOID) get_argname(arg_sname(ad), name);
  157.   
  158.      if ( ARG_isPOSITIONAL(ad) ) {
  159.         sprintf( buf, "<%s>", name );
  160.      }
  161.      else {
  162. !       (VOID) get_kwdname(arg_sname(ad), keyword);
  163.         (VOID) strcpy( buf, keyword );
  164.         pos = buf + strlen(buf);
  165.   
  166. *** arglist.c.OLD    Mon Jun  3 11:14:22 1991
  167. --- arglist.c    Mon May 13 13:44:24 1991
  168. ***************
  169. *** 94,100 ****
  170.      ArgListHead *nl;
  171.      ArgList *nd;
  172.   
  173. !    (VOID) get_name( arg_sname(ad), argname );
  174.      if (copyf) {
  175.         register int i;
  176.   
  177. --- 94,100 ----
  178.      ArgListHead *nl;
  179.      ArgList *nd;
  180.   
  181. !    (VOID) get_argname( arg_sname(ad), argname );
  182.      if (copyf) {
  183.         register int i;
  184.   
  185. *** argtype.c.OLD    Mon Jun  3 11:14:26 1991
  186. --- argtype.c    Mon May 13 13:44:25 1991
  187. ***************
  188. *** 202,208 ****
  189.      char *cp;
  190.      argName_t  argname;
  191.   
  192. !    (VOID) get_name( arg_sname(ad), argname );
  193.      if (copyf) {
  194.         register int i;
  195.   
  196. --- 202,208 ----
  197.      char *cp;
  198.      argName_t  argname;
  199.   
  200. !    (VOID) get_argname( arg_sname(ad), argname );
  201.      if (copyf) {
  202.         register int i;
  203.   
  204. ***************
  205. *** 270,276 ****
  206.      int status = FALSE;
  207.      char c;
  208.   
  209. !    (VOID) get_name( arg_sname(ad), argname );
  210.      if (!vp || !*vp) {
  211.         status = FALSE;
  212.      }
  213. --- 270,276 ----
  214.      int status = FALSE;
  215.      char c;
  216.   
  217. !    (VOID) get_argname( arg_sname(ad), argname );
  218.      if (!vp || !*vp) {
  219.         status = FALSE;
  220.      }
  221. ***************
  222. *** 340,346 ****
  223.      argName_t  argname; \
  224.      num_t  value; \
  225.    \
  226. !    (VOID) get_name( arg_sname(ad), argname ); \
  227.      value = (num_t) strtol(vp, &vpp, 0); \
  228.      if (*vpp != '\0') { \
  229.         usrerr("invalid integer argument '%s' for %s", vp, argname); \
  230. --- 340,346 ----
  231.      argName_t  argname; \
  232.      num_t  value; \
  233.    \
  234. !    (VOID) get_argname( arg_sname(ad), argname ); \
  235.      value = (num_t) strtol(vp, &vpp, 0); \
  236.      if (*vpp != '\0') { \
  237.         usrerr("invalid integer argument '%s' for %s", vp, argname); \
  238. ***************
  239. *** 401,407 ****
  240.      argName_t  argname; \
  241.      dec_t  value; \
  242.    \
  243. !    (VOID) get_name( arg_sname(ad), argname ); \
  244.      value = (dec_t) strtod(vp, &vpp); \
  245.      if (*vpp != '\0') { \
  246.         usrerr("invalid decimal argument '%s' for %s", vp, argname); \
  247. --- 401,407 ----
  248.      argName_t  argname; \
  249.      dec_t  value; \
  250.    \
  251. !    (VOID) get_argname( arg_sname(ad), argname ); \
  252.      value = (dec_t) strtod(vp, &vpp); \
  253.      if (*vpp != '\0') { \
  254.         usrerr("invalid decimal argument '%s' for %s", vp, argname); \
  255. ***************
  256. *** 504,510 ****
  257.      argName_t  argname;
  258.      int len;
  259.   
  260. !    (VOID) get_name( arg_sname(ad), argname );
  261.   
  262.      /* ARGVECs are not supported for this Boolean arg-types */
  263.      if ( ARG_isVEC(ad) )
  264. --- 504,510 ----
  265.      argName_t  argname;
  266.      int len;
  267.   
  268. !    (VOID) get_argname( arg_sname(ad), argname );
  269.   
  270.      /* ARGVECs are not supported for this Boolean arg-types */
  271.      if ( ARG_isVEC(ad) )
  272. ***************
  273. *** 574,580 ****
  274.      argName_t  argname;
  275.      BOOL  retval;
  276.   
  277. !    (VOID) get_name( arg_sname(ad), argname );
  278.   
  279.      /* ARGVECs are not supported for this Boolean arg-types */
  280.      if ( ARG_isVEC(ad) )
  281. --- 574,580 ----
  282.      argName_t  argname;
  283.      BOOL  retval;
  284.   
  285. !    (VOID) get_argname( arg_sname(ad), argname );
  286.   
  287.      /* ARGVECs are not supported for this Boolean arg-types */
  288.      if ( ARG_isVEC(ad) )
  289. ***************
  290. *** 596,602 ****
  291.      argName_t  argname;
  292.      BOOL  retval;
  293.   
  294. !    (VOID) get_name( arg_sname(ad), argname );
  295.   
  296.      /* ARGVECs are not supported for this Boolean arg-types */
  297.      if ( ARG_isVEC(ad) )
  298. --- 596,602 ----
  299.      argName_t  argname;
  300.      BOOL  retval;
  301.   
  302. !    (VOID) get_argname( arg_sname(ad), argname );
  303.   
  304.      /* ARGVECs are not supported for this Boolean arg-types */
  305.      if ( ARG_isVEC(ad) )
  306. ***************
  307. *** 618,624 ****
  308.      argName_t  argname;
  309.      BOOL  retval;
  310.   
  311. !    (VOID) get_name( arg_sname(ad), argname );
  312.   
  313.      /* ARGVECs are not supported for this Boolean arg-types */
  314.      if ( ARG_isVEC(ad) )
  315. --- 618,624 ----
  316.      argName_t  argname;
  317.      BOOL  retval;
  318.   
  319. !    (VOID) get_argname( arg_sname(ad), argname );
  320.   
  321.      /* ARGVECs are not supported for this Boolean arg-types */
  322.      if ( ARG_isVEC(ad) )
  323. *** doc/Makefile.OLD    Mon Jun  3 11:14:32 1991
  324. --- doc/Makefile    Tue May 14 14:38:21 1991
  325. ***************
  326. *** 144,150 ****
  327.   clobber: clean
  328.       ${DEL} *.txt
  329.   
  330. ! spell: ${INCS} ${SRCS}}
  331.       ${SPELL} ${SPELLFLAGS} ${INCS} ${SRCS}
  332.   
  333.   print: ${MANFILES} ${INCS}
  334. --- 144,150 ----
  335.   clobber: clean
  336.       ${DEL} *.txt
  337.   
  338. ! spell: ${INCS} ${SRCS}
  339.       ${SPELL} ${SPELLFLAGS} ${INCS} ${SRCS}
  340.   
  341.   print: ${MANFILES} ${INCS}
  342. *** doc/argdesc.inc.OLD    Mon Jun  3 11:14:40 1991
  343. --- doc/argdesc.inc    Sat May 11 12:17:40 1991
  344. ***************
  345. *** 49,57 ****
  346.   description (the description must be separated from the long-name by
  347.   at least one whitespace character and may optionally be enclosed in
  348.   a set of balanced delimiters (such as parentheses, curly-braces,
  349. ! square-brackets, or angle-brackets). If the long-name contains any
  350.   uppercase characters, then the substring of long-name consisting of
  351. ! all uppercase characters is used as the argument keyword and the entire
  352. ! long-name is used as the name of the argument (if a value may be
  353. ! supplied). The long-name may be matched by supplying a unique prefix
  354. ! of either the argument keyword or the argument name.
  355. --- 49,63 ----
  356.   description (the description must be separated from the long-name by
  357.   at least one whitespace character and may optionally be enclosed in
  358.   a set of balanced delimiters (such as parentheses, curly-braces,
  359. ! square-brackets, or angle-brackets). The longname may be specifed
  360. ! in two parts: a keyword name and an argument name. The argument
  361. ! name may be separated from the keyword name by a single equal sign
  362. ! (`='). No whitespace is allowed before or after the equal sign.
  363. ! Alternatatively, the keyword name may be distinguished from the
  364. ! argument name by character case: if the long-name contains any
  365.   uppercase characters, then the substring of long-name consisting of
  366. ! all uppercase characters is used as the argument keyword and the
  367. ! entire long-name is used as the name of the argument (if a value may
  368. ! be supplied). The long-name may be matched by supplying a unique
  369. ! prefix of either the argument keyword or the argument name.
  370. *** doc/parseargs.man1.OLD    Mon Jun  3 11:15:49 1991
  371. --- doc/parseargs.man1    Sat May 11 12:20:43 1991
  372. ***************
  373. *** 158,163 ****
  374. --- 158,176 ----
  375.   and printed in usage messages. This string may be followed by a
  376.   textual description that is enclosed in parentheses, square brackets,
  377.   curly braces, or angle brackets.
  378. + The prompt-string may be specifed
  379. + in two parts: a keyword name and an argument name. The argument
  380. + name may be separated from the keyword name by a single equal sign
  381. + ('='). No whitespace is allowed before or after the equal sign.
  382. + Alternatatively, the keyword name may be distinguished from the
  383. + argument name by character case: if the long-name contains any
  384. + uppercase characters, then the substring of long-name consisting of
  385. + all uppercase characters is used as the argument keyword and the
  386. + entire long-name is used as the name of the argument (if a value may
  387. + be supplied). The long-name may be matched by supplying a unique
  388. + prefix of either the argument keyword or the argument name.
  389.   .PP
  390.   The argument specification string must be terminated by the single string:
  391.   ``ENDOFARGS''.
  392. *** doc/returns.inc.OLD    Mon Jun  3 11:16:33 1991
  393. --- doc/returns.inc    Mon May 20 17:36:20 1991
  394. ***************
  395. *** 28,35 ****
  396.   .IP "\fIpe_\s-1NOMATCH\s+1\fP"
  397.   Unable to match the named argument. This occurs
  398.   when the argument keyword name passed to \fIparsecntl\fP (using the 
  399. ! \fIpc_\s-1ARGFLAGS\s+1\fP functions code) was found in the given argdesc-array
  400. ! or in its default-list.
  401.   .\"---------------------------------------------
  402.   .IP "\fIpe_\s-1BADMODE\s+1\fP"
  403.   Bad mode for given command in \fIparsecntl\fP. This occurs when 
  404. --- 28,35 ----
  405.   .IP "\fIpe_\s-1NOMATCH\s+1\fP"
  406.   Unable to match the named argument. This occurs
  407.   when the argument keyword name passed to \fIparsecntl\fP (using the 
  408. ! \fIpc_\s-1ARGFLAGS\s+1\fP functions code) was NOT found in the given
  409. ! argdesc-array or in its default-list.
  410.   .\"---------------------------------------------
  411.   .IP "\fIpe_\s-1BADMODE\s+1\fP"
  412.   Bad mode for given command in \fIparsecntl\fP. This occurs when 
  413. *** ibm_args.c.OLD    Mon Jun  3 11:17:03 1991
  414. --- ibm_args.c    Mon May 13 13:44:26 1991
  415. ***************
  416. *** 301,307 ****
  417.                     BSET( arg_flags(ad), ARGGIVEN );
  418.                  }
  419.                  else {
  420. !                   (VOID) get_keyword( arg_sname(ad), name );
  421.                     usrerr("%c%s switch requires an argument", KwdPrefix, name);
  422.                     arg_flags(ad) = flags;
  423.                     parse_error = pe_SYNTAX;
  424. --- 301,307 ----
  425.                     BSET( arg_flags(ad), ARGGIVEN );
  426.                  }
  427.                  else {
  428. !                   (VOID) get_kwdname( arg_sname(ad), name );
  429.                     usrerr("%c%s switch requires an argument", KwdPrefix, name);
  430.                     arg_flags(ad) = flags;
  431.                     parse_error = pe_SYNTAX;
  432. ***************
  433. *** 429,435 ****
  434.                        BSET( arg_flags(ad), ARGGIVEN );
  435.                     }
  436.                     else {
  437. !                      (VOID) get_name(arg_sname(ad), name);
  438.                        usrerr( "%s required for %c%c flag",
  439.                                name, OptPrefix, arg_cname(ad) );
  440.                        arg_flags(ad) = flags;
  441. --- 429,435 ----
  442.                        BSET( arg_flags(ad), ARGGIVEN );
  443.                     }
  444.                     else {
  445. !                      (VOID) get_argname(arg_sname(ad), name);
  446.                        usrerr( "%s required for %c%c flag",
  447.                                name, OptPrefix, arg_cname(ad) );
  448.                        arg_flags(ad) = flags;
  449. ***************
  450. *** 585,597 ****
  451.      char *pos;
  452.      argName_t   name, keyword;
  453.   
  454. !    (VOID) get_name( arg_sname(ad), name );
  455.   
  456.      if (ARG_isPOSITIONAL(ad)) {
  457.         sprintf( buf, "<%s>", name );
  458.      }
  459.      else {
  460. !       (VOID) get_keyword( arg_sname(ad), keyword );
  461.   
  462.         if ( isupper(arg_cname(ad))  &&  toupper(*keyword) == arg_cname(ad) ) {
  463.            *keyword = toupper(*keyword);
  464. --- 585,597 ----
  465.      char *pos;
  466.      argName_t   name, keyword;
  467.   
  468. !    (VOID) get_argname( arg_sname(ad), name );
  469.   
  470.      if (ARG_isPOSITIONAL(ad)) {
  471.         sprintf( buf, "<%s>", name );
  472.      }
  473.      else {
  474. !       (VOID) get_kwdname( arg_sname(ad), keyword );
  475.   
  476.         if ( isupper(arg_cname(ad))  &&  toupper(*keyword) == arg_cname(ad) ) {
  477.            *keyword = toupper(*keyword);
  478. *** parseargs.awk.OLD    Mon Jun  3 11:17:09 1991
  479. --- parseargs.awk    Wed May 15 10:03:26 1991
  480. ***************
  481. *** 40,46 ****
  482.   ##    The following global variables may be assigned before calling parseargs:
  483.   ##
  484.   ##       PROGNAME -- name of the current awk script (default= ARGV[0])
  485. ! ##       PARSEOPTS -- any extra options to pass toi parseargs() (default="-ul")
  486.   ##       PARSEINPUT -- input file for parseargs(1) (default=unique-name)
  487.   ##       PARSEOUTPUT -- output file for parseargs(1) (default=unique-name)
  488.   ##
  489. --- 40,46 ----
  490.   ##    The following global variables may be assigned before calling parseargs:
  491.   ##
  492.   ##       PROGNAME -- name of the current awk script (default= ARGV[0])
  493. ! ##       PARSEOPTS -- any extra options to pass to parseargs() (default="-ul")
  494.   ##       PARSEINPUT -- input file for parseargs(1) (default=unique-name)
  495.   ##       PARSEOUTPUT -- output file for parseargs(1) (default=unique-name)
  496.   ##
  497. *** parseargs.c.OLD    Mon Jun  3 11:17:16 1991
  498. --- parseargs.c    Thu May 16 16:51:21 1991
  499. ***************
  500. *** 1092,1098 ****
  501.   #endif
  502.   {
  503.      int  i;
  504. !    register char *sh = sh_str;
  505.   
  506.         /* special case to recognize tcsh & itcsh */
  507.      if ( strEQ( sh, "tcsh" ) )  ++sh;
  508. --- 1092,1098 ----
  509.   #endif
  510.   {
  511.      int  i;
  512. !    register CONST char *sh = sh_str;
  513.   
  514.         /* special case to recognize tcsh & itcsh */
  515.      if ( strEQ( sh, "tcsh" ) )  ++sh;
  516. *** parseargs.h.OLD    Mon Jun  3 11:17:24 1991
  517. --- parseargs.h    Mon May 20 17:35:46 1991
  518. ***************
  519. *** 97,103 ****
  520.   **       description (the description must be separated from the long-name by
  521.   **       at least one whitespace character and may optionally be enclosed in
  522.   **       a set of balanced delimiters (such as parentheses, curly-braces,
  523. ! **       square-brackets, or angle-brackets). If the long-name contains any
  524.   **       uppercase characters, then the substring of long-name consisting of
  525.   **       all uppercase characters is used as the argument keyword and the
  526.   **       entire long-name is used as the name of the argument (if a value may
  527. --- 97,108 ----
  528.   **       description (the description must be separated from the long-name by
  529.   **       at least one whitespace character and may optionally be enclosed in
  530.   **       a set of balanced delimiters (such as parentheses, curly-braces,
  531. ! **       square-brackets, or angle-brackets). The longname may be specifed
  532. ! **       in two parts: a keyword name and an argument name. The argument
  533. ! **       name may be separated from the keyword name by a single equal sign
  534. ! **       ('='). No whitespace is allowed before or after the equal sign.
  535. ! **       Alternatatively, the keyword name may be distinguished from the
  536. ! **       argument name by character case: if the long-name contains any
  537.   **       uppercase characters, then the substring of long-name consisting of
  538.   **       all uppercase characters is used as the argument keyword and the
  539.   **       entire long-name is used as the name of the argument (if a value may
  540. ***************
  541. *** 140,146 ****
  542.   #define  pe_NOMATCH   3
  543.   /*    -- unable to match the named argument. This occurs
  544.   **       when the argument keyword name passed to parsecntl() (using the 
  545. ! **       pc_ARGFLAGS functions code) was found in the given argdesc-array
  546.   **       or in its default-list.
  547.   */
  548.   #define  pe_BADMODE   4
  549. --- 145,151 ----
  550.   #define  pe_NOMATCH   3
  551.   /*    -- unable to match the named argument. This occurs
  552.   **       when the argument keyword name passed to parsecntl() (using the 
  553. ! **       pc_ARGFLAGS function code) was NOT found in the given argdesc-array
  554.   **       or in its default-list.
  555.   */
  556.   #define  pe_BADMODE   4
  557. *** parseargs.pl.OLD    Mon Jun  3 11:17:30 1991
  558. --- parseargs.pl    Wed May 15 10:02:06 1991
  559. ***************
  560. *** 39,45 ****
  561.   ;#    The global variable PARSEARGS will contain the command-line used to
  562.   ;#    invoke parseargs(1).
  563.   ;#
  564. ! ;#    ARGV and ARGC may be reset, all other values are (re)set in <arr>.
  565.   ;#
  566.   ;# ^RETURN-VALUE:
  567.   ;#    The exit code returned by parseargs(1).
  568. --- 39,45 ----
  569.   ;#    The global variable PARSEARGS will contain the command-line used to
  570.   ;#    invoke parseargs(1).
  571.   ;#
  572. ! ;#    ARGV and (and any other variables named in <argd>) may be overwritten.
  573.   ;#
  574.   ;# ^RETURN-VALUE:
  575.   ;#    The exit code returned by parseargs(1).
  576. *** patchlevel.h.OLD    Mon Jun  3 11:17:35 1991
  577. --- patchlevel.h    Mon Jun  3 10:35:24 1991
  578. ***************
  579. *** 2,7 ****
  580. --- 2,21 ----
  581.   ** ^FILE: patchlevel.h - current patchlevel for parseargs
  582.   **
  583.   ** ^HISTORY:
  584. + **    05/11/91    Brad Appleton    <brad@ssd.csd.harris.com>
  585. + **    Patch06
  586. + **    - parsecntl(3) now correctly handles mispelled keywords for the
  587. + **      pc_ARGFLAGS request (it was looping forever).
  588. + **    - fixed an error in the documentation (a "NOT" was omitted).
  589. + **    - added #ifdef SVR4 stuff to unix_man.c to print System V Release 4
  590. + **      style manual pages.
  591. + **    - allowed "sname=aname" syntax in the ad_prompt field of an ARGDESC
  592. + **      in addition to the existing syntax. This new syntax allows argument
  593. + **      names to be be completely different from keyword names.
  594. + **    - changed get_name() & get_keyword to get_argname() & get_kwdname()
  595. + **      (respectively) in strfuncs.[ch]. Also sped up the algorithm to get
  596. + **      the keyword (since it no longer needs malloc).
  597. + **
  598.   **    04/25/91    Brad Appleton    <brad@ssd.csd.harris.com>
  599.   **    Patch05
  600.   **    - documented support for zsh in parseargs(1)
  601. ***************
  602. *** 66,72 ****
  603.   
  604.   #define  VERSION     2
  605.   #define  REVISION    0
  606. ! #define  PATCHLEVEL  5
  607.   
  608.   #ifdef __STDC__
  609.      static const char
  610. --- 80,86 ----
  611.   
  612.   #define  VERSION     2
  613.   #define  REVISION    0
  614. ! #define  PATCHLEVEL  6
  615.   
  616.   #ifdef __STDC__
  617.      static const char
  618. ***************
  619. *** 73,76 ****
  620.   #else
  621.      static char
  622.   #endif
  623. !    _Ident[] = "@(#)parseargs  2.0  patchlevel 5";
  624. --- 87,90 ----
  625.   #else
  626.      static char
  627.   #endif
  628. !    _Ident[] = "@(#)parseargs  2.0  patchlevel 6";
  629. *** stest.c.OLD    Mon Jun  3 11:17:47 1991
  630. --- stest.c    Mon Jun  3 10:34:00 1991
  631. ***************
  632. *** 115,121 ****
  633.      'n', ARGREQ|ARGPOS, argStr,  __ &Name,  "name (name to look for)",
  634.      's', ARGVALOPT, argStr,  __ &Str,       "STRing (optional string to use)",
  635.      'g', ARGVEC,    argStr,  __ &Groups,    "newsGROUPS (newsgroups to test)",
  636. !    'c', ARGOPT,    argInt,  __ &RepCount,  "REPcount (repeat count per group)",
  637.      'd', ARGOPT,    argStr,   __ &DirName,  "DIRname (work directory)",
  638.      'i', ARGVEC,    argInt,   __ &Integers, "INTegerS (vector of numbers)",
  639.      '#', ARGHIDDEN, argBool,  __ &XRated,   "XratedMODE (naughty! naughty!)",
  640. --- 115,121 ----
  641.      'n', ARGREQ|ARGPOS, argStr,  __ &Name,  "name (name to look for)",
  642.      's', ARGVALOPT, argStr,  __ &Str,       "STRing (optional string to use)",
  643.      'g', ARGVEC,    argStr,  __ &Groups,    "newsGROUPS (newsgroups to test)",
  644. !    'c', ARGOPT,    argInt,  __ &RepCount,  "REP=count (repeat count per group)",
  645.      'd', ARGOPT,    argStr,   __ &DirName,  "DIRname (work directory)",
  646.      'i', ARGVEC,    argInt,   __ &Integers, "INTegerS (vector of numbers)",
  647.      '#', ARGHIDDEN, argBool,  __ &XRated,   "XratedMODE (naughty! naughty!)",
  648. ***************
  649. *** 124,130 ****
  650.      'y', ARGOPT, argUBool, __ &YFlag, "Yflag (unset Y flag)",
  651.      'z', ARGOPT, argTBool, __ &ZFlag, "Zflag (toggle Z flag)",
  652.   
  653. !    't', ARGOPT,   argChar, __ &TabChar, "TABchar (field delimiter)",
  654.      'r', ARGNOVAL, argMine, __ NULL,     "raw (trigger raw-mode \
  655.   before processing any more arguments on the command-line)",
  656.   
  657. --- 124,130 ----
  658.      'y', ARGOPT, argUBool, __ &YFlag, "Yflag (unset Y flag)",
  659.      'z', ARGOPT, argTBool, __ &ZFlag, "Zflag (toggle Z flag)",
  660.   
  661. !    't', ARGOPT,   argChar, __ &TabChar, "TAB=char (field delimiter)",
  662.      'r', ARGNOVAL, argMine, __ NULL,     "raw (trigger raw-mode \
  663.   before processing any more arguments on the command-line)",
  664.   
  665. ***************
  666. *** 143,149 ****
  667.      'n', ARGREQ|ARGPOS, argStr,  __ &Name,  "name (name to look for)",
  668.      's', ARGVALOPT, argStr,  __ &Str,       "STRing (optional string to use)",
  669.      'g', ARGVEC,    argStr,  __ &Groups,    "newsGROUPS (newsgroups to test)",
  670. !    'c', ARGOPT,    argInt,  __ &RepCount,  "REPcount (repeat count per group)",
  671.      'd', ARGOPT,    argStr,   __ &DirName,  "DIRname (work directory)",
  672.      'i', ARGVEC,    argInt,   __ &Integers, "INTegerS (vector of numbers)",
  673.      '#', ARGHIDDEN, argBool,  __ &XRated,   "XratedMODE (naughty! naughty!)",
  674. --- 143,149 ----
  675.      'n', ARGREQ|ARGPOS, argStr,  __ &Name,  "name (name to look for)",
  676.      's', ARGVALOPT, argStr,  __ &Str,       "STRing (optional string to use)",
  677.      'g', ARGVEC,    argStr,  __ &Groups,    "newsGROUPS (newsgroups to test)",
  678. !    'c', ARGOPT,    argInt,  __ &RepCount,  "REP=count (repeat count per group)",
  679.      'd', ARGOPT,    argStr,   __ &DirName,  "DIRname (work directory)",
  680.      'i', ARGVEC,    argInt,   __ &Integers, "INTegerS (vector of numbers)",
  681.      '#', ARGHIDDEN, argBool,  __ &XRated,   "XratedMODE (naughty! naughty!)",
  682. ***************
  683. *** 152,158 ****
  684.      'y', ARGOPT, argUBool, __ &YFlag, "Yflag (unset Y flag)",
  685.      'z', ARGOPT, argTBool, __ &ZFlag, "Zflag (toggle Z flag)",
  686.   
  687. !    't', ARGOPT,   argChar, __ &TabChar, "TABchar (field delimiter)",
  688.      'r', ARGNOVAL, argMine, __ NULL,     "raw (trigger raw-mode \
  689.   before processing any more arguments on the command-line)",
  690.   
  691. --- 152,158 ----
  692.      'y', ARGOPT, argUBool, __ &YFlag, "Yflag (unset Y flag)",
  693.      'z', ARGOPT, argTBool, __ &ZFlag, "Zflag (toggle Z flag)",
  694.   
  695. !    't', ARGOPT,   argChar, __ &TabChar, "TAB=char (field delimiter)",
  696.      'r', ARGNOVAL, argMine, __ NULL,     "raw (trigger raw-mode \
  697.   before processing any more arguments on the command-line)",
  698.   
  699. ***************
  700. *** 258,264 ****
  701.      printf( "XRated=%d, Raw-Mode = \"%s\"\n", XRated, Mode );
  702.   
  703.         /* to call parsecntl() to see if the optional value was supplied */
  704. !    (VOID) parsecntl( (ARGDESC *)argd, pc_ARGFLAGS, pc_READ, "string", &flags);
  705.   
  706.      if ( BTEST(flags, ARGGIVEN) && !BTEST(flags, ARGVALGIVEN) ) {
  707.         printf("String=!No Value Given on CmdLine!\n" );
  708. --- 258,264 ----
  709.      printf( "XRated=%d, Raw-Mode = \"%s\"\n", XRated, Mode );
  710.   
  711.         /* to call parsecntl() to see if the optional value was supplied */
  712. !    i = parsecntl( (ARGDESC *)argd, pc_ARGFLAGS, pc_READ, "string", &flags);
  713.   
  714.      if ( BTEST(flags, ARGGIVEN) && !BTEST(flags, ARGVALGIVEN) ) {
  715.         printf("String=!No Value Given on CmdLine!\n" );
  716. *** strfuncs.c.OLD    Mon Jun  3 11:17:52 1991
  717. --- strfuncs.c    Wed May 15 14:33:16 1991
  718. ***************
  719. *** 23,30 ****
  720.   **       strtrim() -- trim leading and trailing characters in a string
  721.   **       strsplit() -- split a string up into a vector of tokens
  722.   **       strjoin() -- join a vector of tokens into a single string
  723. ! **       get_name() -- return the aname (argument-name) of an argument
  724. ! **       get_keyword() -- return the sname (keyword-name) of an argument
  725.   **       match() -- match two keywords (case insensitive) upto a unique prefix
  726.   **       basename() -- remove the leading directories (and disks) from a path
  727.   **       indent_para() -- print an indented hanging paragraph
  728. --- 23,30 ----
  729.   **       strtrim() -- trim leading and trailing characters in a string
  730.   **       strsplit() -- split a string up into a vector of tokens
  731.   **       strjoin() -- join a vector of tokens into a single string
  732. ! **       get_argname() -- return the aname (argument-name) of an argument
  733. ! **       get_kwdname() -- return the sname (keyword-name) of an argument
  734.   **       match() -- match two keywords (case insensitive) upto a unique prefix
  735.   **       basename() -- remove the leading directories (and disks) from a path
  736.   **       indent_para() -- print an indented hanging paragraph
  737. ***************
  738. *** 47,57 ****
  739.   
  740.   static CONST char WhiteSpace[] = " \t\n\r\v\f";
  741.   
  742.   #if ( defined(unix_style)  ||  defined(ibm_style) )
  743.   # define  TO_KWDCASE(c)  TOLOWER(c)
  744.   #else
  745.   # define  TO_KWDCASE(c)  TOUPPER(c)
  746.   #endif
  747.   
  748.   
  749. --- 47,59 ----
  750.   
  751.   static CONST char WhiteSpace[] = " \t\n\r\v\f";
  752.   
  753. ! #define c_ARG_SEP '='
  754.   #if ( defined(unix_style)  ||  defined(ibm_style) )
  755.   # define  TO_KWDCASE(c)  TOLOWER(c)
  756. + # define  KWDCASECOPY(dest,src)  strlcpy(dest,src)
  757.   #else
  758.   # define  TO_KWDCASE(c)  TOUPPER(c)
  759. + # define  KWDCASECOPY(dest,src)  strucpy(dest,src)
  760.   #endif
  761.   
  762.   
  763. ***************
  764. *** 746,757 ****
  765.   
  766.   
  767.   /***************************************************************************
  768. ! ** ^FUNCTION: get_name - return the aname (argument-name) of an argument
  769.   **
  770.   ** ^SYNOPSIS:
  771.   */
  772.   #ifndef __ANSI_C__
  773. !    char  *get_name( s, buf )
  774.   /*
  775.   ** ^PARAMETERS:
  776.   */
  777. --- 748,759 ----
  778.   
  779.   
  780.   /***************************************************************************
  781. ! ** ^FUNCTION: get_argname - return the aname (argument-name) of an argument
  782.   **
  783.   ** ^SYNOPSIS:
  784.   */
  785.   #ifndef __ANSI_C__
  786. !    char  *get_argname( s, buf )
  787.   /*
  788.   ** ^PARAMETERS:
  789.   */
  790. ***************
  791. *** 764,770 ****
  792.   #endif  /* !__ANSI_C__ */
  793.   
  794.   /* ^DESCRIPTION:
  795. ! **    Get_name will get the full argument name of the given argument
  796.   **    (not just the keyword name) and copy it to buf.
  797.   **
  798.   ** ^REQUIREMENTS:
  799. --- 766,772 ----
  800.   #endif  /* !__ANSI_C__ */
  801.   
  802.   /* ^DESCRIPTION:
  803. ! **    Get_argname will get the full argument name of the given argument
  804.   **    (not just the keyword name) and copy it to buf.
  805.   **
  806.   ** ^REQUIREMENTS:
  807. ***************
  808. *** 782,803 ****
  809.   **    and copy the result in the given buffer
  810.   ***^^**********************************************************************/
  811.   #ifdef __ANSI_C__
  812. !    char *get_name( const char *s, char *buf )
  813.   #endif
  814.   {
  815. !       /* <buf> must be large enough to hold the result! */
  816. !    strlcpy(buf, s);
  817.      return   buf;
  818.   }
  819.   
  820.   
  821.   /***************************************************************************
  822. ! ** ^FUNCTION: get_keyword - get the sname (keyword name) of an argument
  823.   **
  824.   ** ^SYNOPSIS:
  825.   */
  826.   #ifndef __ANSI_C__
  827. !    char  *get_keyword( s, buf )
  828.   /*
  829.   ** ^PARAMETERS:
  830.   */
  831. --- 784,815 ----
  832.   **    and copy the result in the given buffer
  833.   ***^^**********************************************************************/
  834.   #ifdef __ANSI_C__
  835. !    char *get_argname( const char *s, char *buf )
  836.   #endif
  837.   {
  838. !    register CONST char *p1 = s, *p2;
  839. !       /* see if sname and aname are separated by c_ARG_SEP
  840. !       ** <buf> must be large enough to hold the result!
  841. !       */
  842. !    p2 = strchr( p1, c_ARG_SEP );
  843. !    if ( p2 ) {
  844. !       strlcpy( buf, ++p2 );
  845. !    }
  846. !    else {
  847. !       strlcpy(buf, s);
  848. !    }
  849.      return   buf;
  850.   }
  851.   
  852.   
  853.   /***************************************************************************
  854. ! ** ^FUNCTION: get_kwdname - get the sname (keyword name) of an argument
  855.   **
  856.   ** ^SYNOPSIS:
  857.   */
  858.   #ifndef __ANSI_C__
  859. !    char  *get_kwdname( s, buf )
  860.   /*
  861.   ** ^PARAMETERS:
  862.   */
  863. ***************
  864. *** 810,816 ****
  865.   #endif  /* !__ANSI_C__ */
  866.   
  867.   /* ^DESCRIPTION:
  868. ! **    Get_name will get the keyword name of the given argument
  869.   **    (not the entire argument name) and copy it to buf.
  870.   **
  871.   **    The sname (keyword-name) consists only of all uppercase characters
  872. --- 822,828 ----
  873.   #endif  /* !__ANSI_C__ */
  874.   
  875.   /* ^DESCRIPTION:
  876. ! **    Get_kwdname will get the keyword name of the given argument
  877.   **    (not the entire argument name) and copy it to buf.
  878.   **
  879.   **    The sname (keyword-name) consists only of all uppercase characters
  880. ***************
  881. *** 833,877 ****
  882.   **    and copy the result in the given buffer
  883.   ***^^**********************************************************************/
  884.   #ifdef __ANSI_C__
  885. !    char *get_keyword( const char *s, char *buf )
  886.   #endif
  887.   {
  888. !    register char *p1 = (char *)s, *p2;
  889. !    register int   i, len = 0;
  890. !    char *caps = CHARNULL;
  891.   
  892.      if ( !p1 )  return  CHARNULL;
  893.   
  894. !       /* find size to copy (use all caps if possible) */
  895. !    for ( p1 = (char *)s ; *p1 ; p1++ )   {
  896. !      if ( !caps  &&  isupper( *p1 ) )  caps = p1;
  897. !          if ( caps   &&   isupper( *p1 ) )   ++len;
  898.      }
  899. -    if ( !caps )   len = (int) (p1 - (char *)s);
  900.   
  901.         /* copy string into buffer and convert it to desired case */
  902.         /* <buf> must be large enough to hold the result! */
  903. !    p1 = buf;
  904. !    if ( len )   {
  905. !      if ( !caps ) {
  906. !         for ( p1 = buf, p2 = (char *)s, i = 0 ; i < len ; p1++, p2++, i++ ) {
  907. !             *p1 = TO_KWDCASE(*p2);
  908. !         }
  909. !      }/*if*/
  910.   
  911. -      else {
  912. -         for ( p2 = caps, i = 0 ; i < len ; p2++ ) {
  913. -            if ( isupper( *p2 ) )   {
  914. -               *(p1++) = TO_KWDCASE(*p2);
  915. -               ++i;
  916. -            }
  917. -         }/*for*/
  918. -      }/*else*/
  919. -    }/*if*/
  920. -    *p1 = '\0';
  921.      return   buf;   /* return buffer address */
  922.   }
  923.   #ifndef amiga_style
  924.   
  925.   /***************************************************************************
  926. --- 845,887 ----
  927.   **    and copy the result in the given buffer
  928.   ***^^**********************************************************************/
  929.   #ifdef __ANSI_C__
  930. !    char *get_kwdname( const char *s, char *buf )
  931.   #endif
  932.   {
  933. !    register char *p1 = (char *)s, *p2, ch;
  934. !    BOOL caps = FALSE;
  935.   
  936.      if ( !p1 )  return  CHARNULL;
  937.   
  938. !       /* see if sname and aname are separated by c_ARG_SEP */
  939. !    p2 = strchr( p1, c_ARG_SEP );
  940. !    if ( p2 ) {
  941. !       ch = *p2;
  942. !       *p2 = '\0';
  943. !       KWDCASECOPY( buf, p1 );
  944. !       *p2 = ch;
  945. !       return  buf;
  946.      }
  947.   
  948.         /* copy string into buffer and convert it to desired case */
  949.         /* <buf> must be large enough to hold the result! */
  950. !    for ( p2 = buf; *p1 ; p1++ ) {
  951. !       if ( isupper(*p1) ) {
  952. !          if ( !caps ) {
  953. !             caps = TRUE;
  954. !             p2 = buf;
  955. !          }
  956. !          *p2++ = TO_KWDCASE(*p1);
  957. !       }
  958. !       else if ( !caps ) {
  959. !          *p2++ = TO_KWDCASE(*p1);
  960. !       }
  961. !    }
  962. !    *p2 = '\0';
  963.   
  964.      return   buf;   /* return buffer address */
  965.   }
  966.   #ifndef amiga_style
  967.   
  968.   /***************************************************************************
  969. ***************
  970. *** 928,945 ****
  971.   #endif
  972.   {
  973.      int  i, clen, tlen, too_short=0;
  974. !    CONST char *full_targ;
  975. !    char *up_targ;
  976.   
  977.   
  978. !    full_targ = target;
  979.   
  980. -       /* make up_targ the uppercase portion of target */
  981. -    up_targ = strdup( full_targ );
  982. -    (VOID) get_keyword( full_targ, up_targ );
  983.         /* match at least MINLEN characters if possible */
  984. !    tlen = strlen( up_targ );
  985.      clen = strlen( candidate );
  986.      if ( (tlen >= MINLEN)   &&   (clen < MINLEN) ) {
  987.         ++too_short;      /* not long enough -- no match */
  988. --- 938,951 ----
  989.   #endif
  990.   {
  991.      int  i, clen, tlen, too_short=0;
  992. !    char  arg_targ[ 256 ], kwd_targ[ 256 ];
  993.   
  994.   
  995. !       /* make kwd_targ the keyword portion of target */
  996. !    (VOID) get_kwdname( target, kwd_targ );
  997.   
  998.         /* match at least MINLEN characters if possible */
  999. !    tlen = strlen( kwd_targ );
  1000.      clen = strlen( candidate );
  1001.      if ( (tlen >= MINLEN)   &&   (clen < MINLEN) ) {
  1002.         ++too_short;      /* not long enough -- no match */
  1003. ***************
  1004. *** 947,953 ****
  1005.   
  1006.   #ifdef vms_style
  1007.         /* if first two chars are NO then match at least MINLEN+2 chars */
  1008. !    if ( !strnicmp(up_targ, "NO", 2) ) {
  1009.         if ( (tlen >= (MINLEN + 2))   &&   (clen < (MINLEN + 2)) ) {
  1010.            ++too_short;      /* not long enough -- no match */
  1011.         }
  1012. --- 953,959 ----
  1013.   
  1014.   #ifdef vms_style
  1015.         /* if first two chars are NO then match at least MINLEN+2 chars */
  1016. !    if ( !strnicmp(kwd_targ, "NO", 2) ) {
  1017.         if ( (tlen >= (MINLEN + 2))   &&   (clen < (MINLEN + 2)) ) {
  1018.            ++too_short;      /* not long enough -- no match */
  1019.         }
  1020. ***************
  1021. *** 954,971 ****
  1022.      }
  1023.   #endif
  1024.   
  1025. !       /* first try to match prefix of the uppercase portion */
  1026. !    i = (too_short) ? -1 : strnicmp(up_targ, candidate, clen);
  1027.   
  1028. -    free( up_targ );
  1029.         /* did we match? */
  1030.      if ( !i )  return  0;   /* yes! */
  1031.   
  1032. !    /* no! : compare the whole target
  1033.      **       match at least MINLEN characters if possible
  1034.      */
  1035. !    tlen = strlen(full_targ);
  1036.      if ( (tlen >= MINLEN)   &&   (clen < MINLEN) ) {
  1037.         return   -1;      /* not long enough -- no match */
  1038.      }
  1039. --- 960,978 ----
  1040.      }
  1041.   #endif
  1042.   
  1043. !       /* first try to match prefix of the keyword portion */
  1044. !    i = (too_short) ? -1 : strnicmp(kwd_targ, candidate, clen);
  1045.   
  1046.         /* did we match? */
  1047.      if ( !i )  return  0;   /* yes! */
  1048.   
  1049. !    /* no! : compare the argument portion
  1050.      **       match at least MINLEN characters if possible
  1051.      */
  1052. !       /* make arg_targ the argument portion of target */
  1053. !    (VOID) get_argname( target, arg_targ );
  1054. !    tlen = strlen(arg_targ);
  1055.      if ( (tlen >= MINLEN)   &&   (clen < MINLEN) ) {
  1056.         return   -1;      /* not long enough -- no match */
  1057.      }
  1058. ***************
  1059. *** 972,978 ****
  1060.   
  1061.   #ifdef vms_style
  1062.      /* if first two chars are NO then match at least MINLEN+2 chars */
  1063. !    if ( !strnicmp(full_targ, "no", 2) ) {
  1064.         if ( (tlen >= (MINLEN + 2))   &&   (clen < (MINLEN + 2)) ) {
  1065.            return   -1;      /* not long enough -- no match */
  1066.         }
  1067. --- 979,985 ----
  1068.   
  1069.   #ifdef vms_style
  1070.      /* if first two chars are NO then match at least MINLEN+2 chars */
  1071. !    if ( !strnicmp(arg_targ, "no", 2) ) {
  1072.         if ( (tlen >= (MINLEN + 2))   &&   (clen < (MINLEN + 2)) ) {
  1073.            return   -1;      /* not long enough -- no match */
  1074.         }
  1075. ***************
  1076. *** 979,985 ****
  1077.      }
  1078.   #endif
  1079.   
  1080. !    return   strnicmp(full_targ, candidate, clen);
  1081.   }
  1082.   
  1083.   
  1084. --- 986,992 ----
  1085.      }
  1086.   #endif
  1087.   
  1088. !    return  strnicmp(arg_targ, candidate, clen);
  1089.   }
  1090.   
  1091.   
  1092. ***************
  1093. *** 992,1014 ****
  1094.      int match( candidate, target) char *candidate, *target;
  1095.   # endif
  1096.   {
  1097. !    int i, j;
  1098. !    char c;
  1099.   
  1100. !    i = j = 0;
  1101.   
  1102. !    while ( isgraph(target[i]) || isgraph(candidate[i]) ) {
  1103. !       while ( islower(target[i]) ) i++;
  1104. !       if ( !isgraph(target[i]) ) {
  1105. !          if ( !isgraph(candidate[j]) )  return 0;
  1106. !          return  stricmp(target, candidate);
  1107. !       }
  1108. !       c = islower( candidate[j] ) ? toupper(candidate[j]) : candidate[j];
  1109. !       if (target[i] != c)  return  stricmp(target, candidate);
  1110. !       i++;
  1111. !       j++;
  1112. !    }
  1113. !    return 0;
  1114.   }
  1115.   
  1116.   #endif
  1117. --- 999,1016 ----
  1118.      int match( candidate, target) char *candidate, *target;
  1119.   # endif
  1120.   {
  1121. !    char kwd_targ[ 256 ], arg_targ[ 256 ];
  1122. !    int rc;
  1123.   
  1124. !    (VOID) get_kwdname( target, kwd_targ );
  1125. !    rc = stricmp( kwd_targ, candidate );
  1126.   
  1127. !    if ( rc == 0 )  return  0;
  1128. !    (VOID) get_argname( target, arg_targ );
  1129. !    rc = stricmp( arg_targ, candidate );
  1130. !    return  rc;
  1131.   }
  1132.   
  1133.   #endif
  1134. *** strfuncs.h.OLD    Mon Jun  3 11:18:00 1991
  1135. --- strfuncs.h    Mon May 13 13:59:31 1991
  1136. ***************
  1137. *** 33,40 ****
  1138.   EXTERN  int    strsplit     ARGS(( char ***, char *, const char * ));
  1139.   EXTERN  char  *strjoin      ARGS(( const char **, const char * ));
  1140.   
  1141. ! EXTERN  char  *get_name     ARGS(( const char *, char * ));
  1142. ! EXTERN  char  *get_keyword  ARGS(( const char *, char * ));
  1143.   EXTERN  int    match        ARGS(( const char *, const char * ));
  1144.   EXTERN  char  *basename     ARGS(( char * ));
  1145.   EXTERN  VOID   indent_para  ARGS(( FILE *, int, int,
  1146. --- 33,40 ----
  1147.   EXTERN  int    strsplit     ARGS(( char ***, char *, const char * ));
  1148.   EXTERN  char  *strjoin      ARGS(( const char **, const char * ));
  1149.   
  1150. ! EXTERN  char  *get_argname  ARGS(( const char *, char * ));
  1151. ! EXTERN  char  *get_kwdname  ARGS(( const char *, char * ));
  1152.   EXTERN  int    match        ARGS(( const char *, const char * ));
  1153.   EXTERN  char  *basename     ARGS(( char * ));
  1154.   EXTERN  VOID   indent_para  ARGS(( FILE *, int, int,
  1155. *** unix_args.c.OLD    Mon Jun  3 11:18:42 1991
  1156. --- unix_args.c    Mon May 13 13:44:30 1991
  1157. ***************
  1158. *** 215,221 ****
  1159.                     BSET( arg_flags(ad), ARGGIVEN );
  1160.                  }
  1161.                  else {
  1162. !                   (VOID) get_keyword( arg_sname(ad), name );
  1163.                     usrerr("option %c%s requires an argument", c_KWD_PFX, name);
  1164.                     arg_flags(ad) = flags;
  1165.                     parse_error = pe_SYNTAX;
  1166. --- 215,221 ----
  1167.                     BSET( arg_flags(ad), ARGGIVEN );
  1168.                  }
  1169.                  else {
  1170. !                   (VOID) get_kwdname( arg_sname(ad), name );
  1171.                     usrerr("option %c%s requires an argument", c_KWD_PFX, name);
  1172.                     arg_flags(ad) = flags;
  1173.                     parse_error = pe_SYNTAX;
  1174. ***************
  1175. *** 339,345 ****
  1176.                        BSET( arg_flags(ad), ARGGIVEN );
  1177.                     }
  1178.                     else {
  1179. !                      (VOID) get_name(arg_sname(ad), name);
  1180.                        usrerr( "%s required for %c%c flag",
  1181.                                name, c_OPT_PFX, arg_cname(ad) );
  1182.                        arg_flags(ad) = flags;
  1183. --- 339,345 ----
  1184.                        BSET( arg_flags(ad), ARGGIVEN );
  1185.                     }
  1186.                     else {
  1187. !                      (VOID) get_argname(arg_sname(ad), name);
  1188.                        usrerr( "%s required for %c%c flag",
  1189.                                name, c_OPT_PFX, arg_cname(ad) );
  1190.                        arg_flags(ad) = flags;
  1191. ***************
  1192. *** 505,517 ****
  1193.      char *pos;
  1194.      argName_t   name, keyword;
  1195.   
  1196. !    (VOID) get_name( arg_sname(ad), name );
  1197.   
  1198.      if (ARG_isPOSITIONAL(ad)) {
  1199.         sprintf( buf, "<%s>", name );
  1200.      }
  1201.      else {
  1202. !       (VOID) get_keyword( arg_sname(ad), keyword );
  1203.   
  1204.         if ( isupper(arg_cname(ad))  &&  toupper(*keyword) == arg_cname(ad) ) {
  1205.            *keyword = toupper(*keyword);
  1206. --- 505,517 ----
  1207.      char *pos;
  1208.      argName_t   name, keyword;
  1209.   
  1210. !    (VOID) get_argname( arg_sname(ad), name );
  1211.   
  1212.      if (ARG_isPOSITIONAL(ad)) {
  1213.         sprintf( buf, "<%s>", name );
  1214.      }
  1215.      else {
  1216. !       (VOID) get_kwdname( arg_sname(ad), keyword );
  1217.   
  1218.         if ( isupper(arg_cname(ad))  &&  toupper(*keyword) == arg_cname(ad) ) {
  1219.            *keyword = toupper(*keyword);
  1220. *** unix_man.c.OLD    Mon Jun  3 11:18:48 1991
  1221. --- unix_man.c    Mon May 13 13:44:31 1991
  1222. ***************
  1223. *** 75,81 ****
  1224.      char *pos;
  1225.      argName_t   name;
  1226.   
  1227. !    (VOID) get_name( arg_sname(ad), name );
  1228.   
  1229.      if (ARG_isPOSITIONAL(ad)) {
  1230.          if ( ARG_isMULTIVAL(ad) ) {
  1231. --- 75,81 ----
  1232.      char *pos;
  1233.      argName_t   name;
  1234.   
  1235. !    (VOID) get_argname( arg_sname(ad), name );
  1236.   
  1237.      if (ARG_isPOSITIONAL(ad)) {
  1238.          if ( ARG_isMULTIVAL(ad) ) {
  1239. ***************
  1240. *** 87,93 ****
  1241. --- 87,97 ----
  1242.          return  strlen(name);
  1243.      }/*if parm*/
  1244.   
  1245. + #ifdef SVR4
  1246. +    sprintf(buf, "\\f4\\-%c\\fP", arg_cname(ad));
  1247. + #else
  1248.      sprintf(buf, "\\fB\\-%c\\fP", arg_cname(ad));
  1249. + #endif
  1250.      pos = buf + strlen(buf);
  1251.   
  1252.      if ( ARG_isVALTAKEN(ad)  &&  !ARG_isBOOLEAN(ad)  &&  !ARG_isPSEUDOARG(ad) ) {
  1253. ***************
  1254. *** 185,191 ****
  1255. --- 189,199 ----
  1256.      printf(".if n .ll 78\n");
  1257.   
  1258.      COMMENT;
  1259. + #ifdef SVR4
  1260. +    TH( name, 1 );
  1261. + #else
  1262.      TH( strupr(name), 1 );
  1263. + #endif
  1264.   
  1265.      COMMENT;
  1266.      SH( "NAME" );
  1267. ***************
  1268. *** 195,201 ****
  1269. --- 203,213 ----
  1270.      SH( "SYNOPSIS" );
  1271.   
  1272.      len = strlen( program ) + 1;
  1273. + #ifdef SVR4
  1274. +    sprintf( name, "\\f4%s\\fP", program );
  1275. + #else
  1276.      sprintf( name, "\\fB%s\\fP", program );
  1277. + #endif
  1278.      TP( len, name );
  1279.   
  1280.      maxlen = 0;
  1281. *** useful.h.OLD    Mon Jun  3 11:18:52 1991
  1282. --- useful.h    Thu May 16 16:21:26 1991
  1283. ***************
  1284. *** 31,36 ****
  1285. --- 31,42 ----
  1286.   # endif
  1287.   #endif /* _unix */
  1288.   
  1289. + #if (defined(_UNIX) || defined(__UNIX) || defined(_UNIX_) || defined(__UNIX__))
  1290. + # ifndef unix
  1291. + #   define unix
  1292. + # endif
  1293. + #endif /* _UNIX */
  1294.      /* give a stab at the dual Unix universe dilemma (UCB vs AT&T) */
  1295.   #ifdef unix
  1296.   # if ( defined(_BSD) && !defined(BSD) )
  1297. ***************
  1298. *** 84,102 ****
  1299.   #endif /* unix */
  1300.   
  1301.   #ifndef MSDOS
  1302. ! # if ( defined(_MSDOS_) || defined(__MSDOS__) || defined(_MSDOS) )
  1303.   #  define MSDOS
  1304.   # endif
  1305.   #endif
  1306.   
  1307.   #ifndef OS2
  1308. ! # if ( defined(_OS2_) || defined(__OS2__) || defined(_OS2) )
  1309.   #  define OS2
  1310.   # endif
  1311.   #endif
  1312.   
  1313.   #ifndef AmigaDOS
  1314. ! # if ( defined(MANX) || defined(AZTEC) )
  1315.   #   define AmigaDOS
  1316.   # endif
  1317.   #endif /* AmigaDOS */
  1318. --- 90,108 ----
  1319.   #endif /* unix */
  1320.   
  1321.   #ifndef MSDOS
  1322. ! # if (defined(_MSDOS_)||defined(__MSDOS__)||defined(_MSDOS)||defined(__MSDOS))
  1323.   #  define MSDOS
  1324.   # endif
  1325.   #endif
  1326.   
  1327.   #ifndef OS2
  1328. ! # if ( defined(_OS2_) || defined(__OS2__) || defined(_OS2) || defined(__OS2) )
  1329.   #  define OS2
  1330.   # endif
  1331.   #endif
  1332.   
  1333.   #ifndef AmigaDOS
  1334. ! # if ( defined(AMIGA) || defined(MANX) || defined(AZTEC) )
  1335.   #   define AmigaDOS
  1336.   # endif
  1337.   #endif /* AmigaDOS */
  1338. ***************
  1339. *** 303,312 ****
  1340.   # endif  /* !_SIZE_T_DEFINED */
  1341.   #endif
  1342.   
  1343. ! #ifndef __malloc_h
  1344. !  EXTERN  ARBPTR  malloc   ARGS(( size_t ));
  1345. !  EXTERN  ARBPTR  realloc  ARGS(( ARBPTR, size_t ));
  1346. !  EXTERN  VOID    free     ARGS(( ARBPTR ));
  1347.   #endif /*__malloc_h*/
  1348.   
  1349.   EXTERN  ARBPTR  ckalloc  ARGS(( size_t ));
  1350. --- 309,316 ----
  1351.   # endif  /* !_SIZE_T_DEFINED */
  1352.   #endif
  1353.   
  1354. ! #if ( !defined(__malloc_h) && !defined(__MALLOC_H) )
  1355. ! # include <malloc.h>
  1356.   #endif /*__malloc_h*/
  1357.   
  1358.   EXTERN  ARBPTR  ckalloc  ARGS(( size_t ));
  1359. *** vms_args.c.OLD    Mon Jun  3 11:18:57 1991
  1360. --- vms_args.c    Mon May 13 13:44:32 1991
  1361. ***************
  1362. *** 683,689 ****
  1363.                  BSET( arg_flags(ad), ARGVALGIVEN );
  1364.               }
  1365.               else {
  1366. !                (VOID) get_keyword( arg_sname(ad), keyword );
  1367.                  usrerr("qualifier %s requires an argument", keyword);
  1368.                  arg_flags(ad) = flags;
  1369.                  parse_error = pe_SYNTAX;
  1370. --- 683,689 ----
  1371.                  BSET( arg_flags(ad), ARGVALGIVEN );
  1372.               }
  1373.               else {
  1374. !                (VOID) get_kwdname( arg_sname(ad), keyword );
  1375.                  usrerr("qualifier %s requires an argument", keyword);
  1376.                  arg_flags(ad) = flags;
  1377.                  parse_error = pe_SYNTAX;
  1378. ***************
  1379. *** 849,861 ****
  1380.      char * pos;
  1381.      argName_t  keyword, name;
  1382.   
  1383. !    (VOID) get_name( arg_sname(ad), name );
  1384.   
  1385.      if (ARG_isPOSITIONAL(ad)) {
  1386.         sprintf( buf, "<%s>", name );
  1387.      }
  1388.      else {
  1389. !       (VOID) get_keyword( arg_sname(ad), keyword );
  1390.         sprintf( buf, "%c%s", *s_KWD_PFX, keyword );
  1391.         pos = buf + strlen(buf);
  1392.   
  1393. --- 849,861 ----
  1394.      char * pos;
  1395.      argName_t  keyword, name;
  1396.   
  1397. !    (VOID) get_argname( arg_sname(ad), name );
  1398.   
  1399.      if (ARG_isPOSITIONAL(ad)) {
  1400.         sprintf( buf, "<%s>", name );
  1401.      }
  1402.      else {
  1403. !       (VOID) get_kwdname( arg_sname(ad), keyword );
  1404.         sprintf( buf, "%c%s", *s_KWD_PFX, keyword );
  1405.         pos = buf + strlen(buf);
  1406.   
  1407. ***************
  1408. *** 965,971 ****
  1409.   
  1410.   
  1411.               if ( ARG_isMULTIVAL(ad) ) {
  1412. !                (VOID) get_name( arg_sname(ad), name );
  1413.                  strcat(buf, "[,<");
  1414.                  strcat(buf, name);
  1415.                  strcat(buf, ">...]");
  1416. --- 965,971 ----
  1417.   
  1418.   
  1419.               if ( ARG_isMULTIVAL(ad) ) {
  1420. !                (VOID) get_argname( arg_sname(ad), name );
  1421.                  strcat(buf, "[,<");
  1422.                  strcat(buf, name);
  1423.                  strcat(buf, ">...]");
  1424. *** xparse.c.OLD    Mon Jun  3 11:19:13 1991
  1425. --- xparse.c    Mon Jun  3 10:29:49 1991
  1426. ***************
  1427. *** 857,872 ****
  1428.            if ( ARG_isREQUIRED(ad)  &&  !ARG_isGIVEN(ad) ) {
  1429.                  /* still didn't get a value... sigh */
  1430.               if ( ARG_isPOSITIONAL(ad) ) {
  1431. !                (VOID) get_name( arg_sname(ad), s );
  1432.                  usrerr("%s required", s);
  1433.               }
  1434.               else {
  1435.   #ifdef amiga_style
  1436. !                (VOID) get_keyword( arg_sname(ad), s );
  1437.                  usrerr("argument required for %s keyword", s);
  1438.   #endif
  1439.   #ifdef ibm_style
  1440. !                (VOID) get_name( arg_sname(ad), s );
  1441.                  {
  1442.                     char c, *pfx = getenv( "SWITCHAR" );
  1443.                     c = ( pfx &&  *pfx ) ? *pfx : '/';
  1444. --- 857,872 ----
  1445.            if ( ARG_isREQUIRED(ad)  &&  !ARG_isGIVEN(ad) ) {
  1446.                  /* still didn't get a value... sigh */
  1447.               if ( ARG_isPOSITIONAL(ad) ) {
  1448. !                (VOID) get_argname( arg_sname(ad), s );
  1449.                  usrerr("%s required", s);
  1450.               }
  1451.               else {
  1452.   #ifdef amiga_style
  1453. !                (VOID) get_kwdname( arg_sname(ad), s );
  1454.                  usrerr("argument required for %s keyword", s);
  1455.   #endif
  1456.   #ifdef ibm_style
  1457. !                (VOID) get_argname( arg_sname(ad), s );
  1458.                  {
  1459.                     char c, *pfx = getenv( "SWITCHAR" );
  1460.                     c = ( pfx &&  *pfx ) ? *pfx : '/';
  1461. ***************
  1462. *** 874,884 ****
  1463.                  }
  1464.   #endif
  1465.   #ifdef unix_style
  1466. !                (VOID) get_name( arg_sname(ad), s );
  1467.                  usrerr("%s required for %c%c flag", s, c_OPT_PFX, arg_cname(ad));
  1468.   #endif
  1469.   #ifdef vms_style
  1470. !                (VOID) get_keyword( arg_sname(ad), s );
  1471.                  usrerr("value required for %c%s qualifier", *s_KWD_PFX, s);
  1472.   #endif
  1473.               }
  1474. --- 874,884 ----
  1475.                  }
  1476.   #endif
  1477.   #ifdef unix_style
  1478. !                (VOID) get_argname( arg_sname(ad), s );
  1479.                  usrerr("%s required for %c%c flag", s, c_OPT_PFX, arg_cname(ad));
  1480.   #endif
  1481.   #ifdef vms_style
  1482. !                (VOID) get_kwdname( arg_sname(ad), s );
  1483.                  usrerr("value required for %c%s qualifier", *s_KWD_PFX, s);
  1484.   #endif
  1485.               }
  1486. ***************
  1487. *** 1689,1701 ****
  1488.               int  *argflags;
  1489.               BOOL  is_match = FALSE;
  1490.   
  1491. !             for (args = argd; !is_match  &&  args; args = cmd_defargs(argd) ) {
  1492. !                for (ad = ARG_FIRST(args); !ARG_isEND(ad); ARG_ADVANCE(ad) ) {
  1493. !                   if (arg_type(ad) == argDummy)   continue;
  1494.                     if ( match(name, arg_sname(ad)) == 0 ) {
  1495.                        is_match = TRUE;
  1496.                        break;
  1497. !                   }
  1498.                  }/*foreach arg*/
  1499.               }/*foreach argdesc*/
  1500.   
  1501. --- 1689,1702 ----
  1502.               int  *argflags;
  1503.               BOOL  is_match = FALSE;
  1504.   
  1505. !             for (args = argd ; args  &&  !is_match ; args = cmd_defargs(args)) {
  1506. !                for (ad = ARG_FIRST(args) ; !ARG_isEND(ad) ; ARG_ADVANCE(ad)) {
  1507. !                   if ( arg_type(ad) == argDummy )  continue;
  1508.                     if ( match(name, arg_sname(ad)) == 0 ) {
  1509.                        is_match = TRUE;
  1510.                        break;
  1511. !                   }/*if*/
  1512.                  }/*foreach arg*/
  1513.               }/*foreach argdesc*/
  1514.   
  1515.