home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume17 / parseargs / patch03 / PATCH
Encoding:
Text File  |  1991-03-30  |  35.9 KB  |  1,103 lines

  1. *** argtype3.txt.OLD    Tue Mar 26 12:01:39 1991
  2. --- argtype3.txt    Tue Mar 26 11:59:44 1991
  3. ***************
  4. *** 38,54 ****
  5.   DESCRIPTION
  6.        Each of these converts a parameter    value to the internal
  7.        form, including validity checking.     Their parameters and
  8. !      return values all behave similarly. One of    these routines
  9. !      are called    when an    argunent of that particular type is
  10. !      matched by    one of the argument parsing function in    par-
  11. !      seargs(3).    When such an argument is matched, its argument
  12. !      translation routines is invoked and is passed (1) the
  13. !      address of    the argument descriptor    for the    matched    argument,
  14. !      (2) the possible argument string for that matched argument,
  15. !      and (3) a boolean filed that is TRUE only if the second
  16. !      parameter points to temporary storage (indicating that some
  17. !      copying may need to be done instead of just pointing to the
  18. !      same object).
  19.   
  20.        Once the argument translation routine is invoked, it is
  21.        responsible for converting    the argument string to the
  22. --- 38,54 ----
  23.   DESCRIPTION
  24.        Each of these converts a parameter    value to the internal
  25.        form, including validity checking.     Their parameters and
  26. !      return values all behave similarly. One of    these routines is
  27. !      called when an argument of    that particular    type is    matched
  28. !      by    one of the argument parsing function in    parseargs(3).
  29. !      When such an argument is matched, its argument translation
  30. !      routines is invoked and is    passed (1) the address of the
  31. !      argument descriptor for the matched argument, (2) the possi-
  32. !      ble argument string for that matched argument, and    (3) a
  33. !      boolean filed that    is TRUE    only if    the second parameter
  34. !      points to temporary storage (indicating that some copying
  35. !      may need to be done instead of just pointing to the same
  36. !      object).
  37.   
  38.        Once the argument translation routine is invoked, it is
  39.        responsible for converting    the argument string to the
  40. ***************
  41. *** 91,103 ****
  42.            still match other arguments.
  43.   
  44.   
  45. ! PSEUDO-TYPES
  46.        ArgUsage is used to specify an argument that causes the com-
  47.        mand usage    to be printed.
  48.   
  49.        ArgDummy is used to force an item to show up in usage-
  50.        messages but the item itself is never matched against any
  51. !      argumenmts    from the command-line.
  52.   
  53.        ArgEnd is used by Amiga style command-lines to indicate an
  54.        argument that forces all remaining    arguments to be    con-
  55. --- 91,103 ----
  56.            still match other arguments.
  57.   
  58.   
  59. ! PSEUDO-TYPES: argUsage,    argDummy, argEnd
  60.        ArgUsage is used to specify an argument that causes the com-
  61.        mand usage    to be printed.
  62.   
  63.        ArgDummy is used to force an item to show up in usage-
  64.        messages but the item itself is never matched against any
  65. !      arguments from the    command-line.
  66.   
  67.        ArgEnd is used by Amiga style command-lines to indicate an
  68.        argument that forces all remaining    arguments to be    con-
  69. ***************
  70. *** 108,114 ****
  71.        available for identification in the corresponding command-
  72.        line styles.
  73.   
  74. ! STRING-TYPES
  75.        ArgStr is one of the few argument translation routines that
  76.        actually uses the copyf flag. If copyf is true then the
  77.        string is duplicated.
  78. --- 108,114 ----
  79.        available for identification in the corresponding command-
  80.        line styles.
  81.   
  82. ! STRING-TYPES: argStr
  83.        ArgStr is one of the few argument translation routines that
  84.        actually uses the copyf flag. If copyf is true then the
  85.        string is duplicated.
  86. ***************
  87. *** 137,143 ****
  88.   
  89.   
  90.   
  91. ! CHARACTER-TYPES
  92.        ArgChar assigns the given character to the    value referenced
  93.        by    arg_valp(ad) (unless the argument is a vector in which
  94.        case the given character is appended to the end).
  95. --- 137,143 ----
  96.   
  97.   
  98.   
  99. ! CHARACTER-TYPES: argChar
  100.        ArgChar assigns the given character to the    value referenced
  101.        by    arg_valp(ad) (unless the argument is a vector in which
  102.        case the given character is appended to the end).
  103. ***************
  104. *** 150,156 ****
  105.        Unlike argStr, argChar will translate character escape
  106.        sequences such as `\n' and    `\012'.
  107.   
  108. ! INTEGER-TYPES
  109.        Each of these functions converts the given    string to the
  110.        desired integral type. The    value may be specified as an
  111.        octal number by specifying    the first digit    to be 0. Simi-
  112. --- 150,156 ----
  113.        Unlike argStr, argChar will translate character escape
  114.        sequences such as `\n' and    `\012'.
  115.   
  116. ! INTEGER-TYPES: argInt, argShort, argLong
  117.        Each of these functions converts the given    string to the
  118.        desired integral type. The    value may be specified as an
  119.        octal number by specifying    the first digit    to be 0. Simi-
  120. ***************
  121. *** 157,167 ****
  122.        larly, If the first two characters    are `0x' then the number
  123.        is    treated    as hexadecimal.
  124.   
  125. ! FLOATING-POINT-TYPES
  126.        Each of these functions converts the given    string to the
  127.        desired floating-point type.
  128.   
  129. ! BOOLEAN-TYPES
  130.        ArgBool and argSBool set a    boolean    value (if no value is
  131.        given).  ArgUBool unsets a    boolean    value (if no value is
  132.        given). ArgTBool toggles a    boolean    value (if no value is
  133. --- 157,167 ----
  134.        larly, If the first two characters    are `0x' then the number
  135.        is    treated    as hexadecimal.
  136.   
  137. ! FLOATING-POINT-TYPES: argFloat,    argDouble
  138.        Each of these functions converts the given    string to the
  139.        desired floating-point type.
  140.   
  141. ! BOOLEAN-TYPES: argBool,    argSBool, argTBool, argUBool
  142.        ArgBool and argSBool set a    boolean    value (if no value is
  143.        given).  ArgUBool unsets a    boolean    value (if no value is
  144.        given). ArgTBool toggles a    boolean    value (if no value is
  145. ***************
  146. *** 209,215 ****
  147.        ``1'', ``+'', ``ON'', or ``TRUE''
  148.         The corresponding boolean flag is set    to TRUE.
  149.   
  150. ! LIST TYPES
  151.        The listStr argument translation routine is only intended
  152.        for use on    behalf of arguments that have the ARGLIST flag
  153.        enabled. It will allocate space for a new node (and for the
  154. --- 209,215 ----
  155.        ``1'', ``+'', ``ON'', or ``TRUE''
  156.         The corresponding boolean flag is set    to TRUE.
  157.   
  158. ! LIST TYPES: listStr
  159.        The listStr argument translation routine is only intended
  160.        for use on    behalf of arguments that have the ARGLIST flag
  161.        enabled. It will allocate space for a new node (and for the
  162. ***************
  163. *** 229,235 ****
  164.        followed by the type of the items in the vector.
  165.   
  166.   SEE ALSO
  167. !      parseargs(3), parseargs(1),
  168.   
  169.   
  170.   
  171. --- 229,235 ----
  172.        followed by the type of the items in the vector.
  173.   
  174.   SEE ALSO
  175. !      parseargs(3), parseargs(3), parsecntl(1),
  176.   
  177.   
  178.   
  179. *** parseargs1.txt.OLD    Tue Mar 26 12:01:48 1991
  180. --- parseargs1.txt    Tue Mar 26 11:59:52 1991
  181. ***************
  182. *** 81,87 ****
  183.        the desired type, and diagnoses problems such as missing
  184.        arguments,    extra arguments, and argument values that are
  185.        syntactically incorrect.  Other behavior such as prompting
  186. !      the user for missing arguments and    ignoring as command-line
  187.        syntax may    be specified on    the command-line through the use
  188.        of    various    options, or through the    use of the ``PARSECNTL''
  189.        environment variable.
  190. --- 81,87 ----
  191.        the desired type, and diagnoses problems such as missing
  192.        arguments,    extra arguments, and argument values that are
  193.        syntactically incorrect.  Other behavior such as prompting
  194. !      the user for missing arguments and    ignoring bad command-line
  195.        syntax may    be specified on    the command-line through the use
  196.        of    various    options, or through the    use of the ``PARSECNTL''
  197.        environment variable.
  198. ***************
  199. *** 233,243 ****
  200.        ``sh'', ``csh'', ``ksh'', ``tcsh'', ``bash'', ``rc'',
  201.        ``awk'', and ``perl'' as valid command interpreters. Awk
  202.        output is slightly    different from that of the other shells
  203. !      in    that the actual    variable setting are not printed but each
  204. !      line of an    associative array is printed (the first    field is
  205. !      the array index, the second is the    value for that index).
  206. !      If    no shell is specified, then the    Bourne shell (``sh'')
  207. !      will be assumed.
  208.   
  209.        If    the user wishes    to use a value other than ``TRUE'' for a
  210.        boolean flag that is true,    this may be done using the -T
  211. --- 233,243 ----
  212.        ``sh'', ``csh'', ``ksh'', ``tcsh'', ``bash'', ``rc'',
  213.        ``awk'', and ``perl'' as valid command interpreters. Awk
  214.        output is slightly    different from that of the other shells
  215. !      in    that the actual    variable settings are not printed but
  216. !      each line of an associative array is printed (the first
  217. !      field is the array    index, the second is the value for that
  218. !      index).  If no shell is specified,    then the Bourne    shell
  219. !      (``sh'') will be assumed.
  220.   
  221.        If    the user wishes    to use a value other than ``TRUE'' for a
  222.        boolean flag that is true,    this may be done using the -T
  223. ***************
  224. *** 274,280 ****
  225.        parseargs to be able to distinguish options to itself from
  226.        options for the calling program.
  227.   
  228. !      The default behavior of parseargs is allow    both single-
  229.        character options and long-options    (keywords) on the
  230.        command-line. The user may    specify    that only options (long-
  231.        options) are to be    permitted by specifying    the -o (-l)
  232. --- 274,280 ----
  233.        parseargs to be able to distinguish options to itself from
  234.        options for the calling program.
  235.   
  236. !      The default behavior of parseargs is to allow both    single-
  237.        character options and long-options    (keywords) on the
  238.        command-line. The user may    specify    that only options (long-
  239.        options) are to be    permitted by specifying    the -o (-l)
  240. ***************
  241. *** 340,349 ****
  242.        positional    parameters of the calling program will be re-
  243.        assigned to the contents of the argument list.
  244.   
  245. !      For the awk and perl, if the variable name    corresponding to
  246. !      the ARGLIST argument is ``ARGV'', then the    positional
  247. !      parameters    of the calling program will be re-assigned to the
  248. !      contents of the argument list.
  249.        Bourne Shell Argument Lists
  250.   
  251.        For the Bourne shell, if the associated variable name is NOT
  252. --- 340,349 ----
  253.        positional    parameters of the calling program will be re-
  254.        assigned to the contents of the argument list.
  255.   
  256. !      For awk and perl, if the variable name corresponding to the
  257. !      ARGLIST argument is ``ARGV'', then    the positional parameters
  258. !      of    the calling program will be re-assigned    to the contents
  259. !      of    the argument list.
  260.        Bourne Shell Argument Lists
  261.   
  262.        For the Bourne shell, if the associated variable name is NOT
  263. ***************
  264. *** 471,479 ****
  265.   
  266.        For perl, each argument list is considered    an array and is
  267.        set using the following syntax:
  268. !       @name=( arg1 , arg2 ,     ... )
  269.   
  270.        The word-lists used by the    C shell, the arrays used by the
  271.        Korn shell, the Plan 9 shell, awk,    perl, and the positional
  272.        parameters    used by    all shells (if overwritten by parseargs)
  273. --- 471,479 ----
  274.   
  275.        For perl, each argument list is considered    an array and is
  276.        set using the following syntax:
  277. !       @name=( arg1 , arg2 ,     ... );
  278. !      A Final Note on Argument Lists
  279.   
  280.        The word-lists used by the    C shell, the arrays used by the
  281.        Korn shell, the Plan 9 shell, awk,    perl, and the positional
  282.        parameters    used by    all shells (if overwritten by parseargs)
  283. ***************
  284. *** 493,499 ****
  285.        is    parsed.     The command-line will over-ride any options that
  286.        are specified in this environment variable    (except    that
  287.        ARGLISTs and ARGVECs set in ``CMD_ARGS'' will be appended
  288. !      from the command-line
  289.   
  290.        It    is important to    note that the contents of the
  291.        ``CMD_ARGS'' environment variable are NOT expanded    by the
  292. --- 493,499 ----
  293.        is    parsed.     The command-line will over-ride any options that
  294.        are specified in this environment variable    (except    that
  295.        ARGLISTs and ARGVECs set in ``CMD_ARGS'' will be appended
  296. !      from the command-line if they are selected).
  297.   
  298.        It    is important to    note that the contents of the
  299.        ``CMD_ARGS'' environment variable are NOT expanded    by the
  300. ***************
  301. *** 552,558 ****
  302.         Ignore any unrecognized or improperly    specified
  303.         command-line arguments and continue execution    of the
  304.         program. Normally, if    an argument is unmatched (or is
  305. !       improperly specified), a usage message is printed
  306.         program execution is terminated.
  307.   
  308.        OptsOnly
  309. --- 552,558 ----
  310.         Ignore any unrecognized or improperly    specified
  311.         command-line arguments and continue execution    of the
  312.         program. Normally, if    an argument is unmatched (or is
  313. !       improperly specified), a usage message is printed and
  314.         program execution is terminated.
  315.   
  316.        OptsOnly
  317. ***************
  318. *** 599,612 ****
  319.   
  320.   
  321.   
  322. !       Setting this flag cause character-case to be ignored
  323.         when attempting to match single-character argument
  324.         names    (i.e. causes "-i" and "-I" will    be considered
  325.         equivalent).
  326.   
  327.        If    the environment    variable ``PARSECNTL'' is empty    or
  328. !      undefined,    then parsing behavior set by the programmer is
  329. !      used.  If the programmer has not explicitly used
  330.        parsecntl(3) to modify the    parsing    behavior, then the
  331.        default behavior will be ``Flags1st'' for Unix systems,
  332.        ``!Prompt + !Ignore'' for AmigaDOS    systems, ``CaseIgnore''
  333. --- 599,612 ----
  334.   
  335.   
  336.   
  337. !       Setting this flag causes character-case to be    ignored
  338.         when attempting to match single-character argument
  339.         names    (i.e. causes "-i" and "-I" will    be considered
  340.         equivalent).
  341.   
  342.        If    the environment    variable ``PARSECNTL'' is empty    or
  343. !      undefined,    then the parsing behavior set by the programmer
  344. !      is    used.  If the programmer has not explicitly used
  345.        parsecntl(3) to modify the    parsing    behavior, then the
  346.        default behavior will be ``Flags1st'' for Unix systems,
  347.        ``!Prompt + !Ignore'' for AmigaDOS    systems, ``CaseIgnore''
  348. *** parseargs3.txt.OLD    Tue Mar 26 12:01:58 1991
  349. --- parseargs3.txt    Tue Mar 26 12:00:11 1991
  350. ***************
  351. *** 15,21 ****
  352.        int  fparseargs(  FILE *fp,  ARGDESC *argd     )
  353.        int  lparseargs(  ArgList *argls,    ARGDESC    *argd  )
  354.        int  sparseargs(  char *str,  ARGDESC *argd  )
  355. !      int  vparseargs(  ARGDESC *argd,  ...  )
  356.        void  usage(  const ARGDESC *argd    )
  357.   
  358.   DESCRIPTION
  359. --- 15,21 ----
  360.        int  fparseargs(  FILE *fp,  ARGDESC *argd     )
  361.        int  lparseargs(  ArgList *argls,    ARGDESC    *argd  )
  362.        int  sparseargs(  char *str,  ARGDESC *argd  )
  363. !      int  vparseargs(  ARGDESC *argd, int argc,     ...  )
  364.        void  usage(  const ARGDESC *argd    )
  365.   
  366.   DESCRIPTION
  367. ***************
  368. *** 39,45 ****
  369.        ``-v\nval'' is a not).
  370.   
  371.        Given an ArgList and an argdesc array, lparseargs will parse
  372. !      arguments in a file in much the same manner as parseargs.
  373.   
  374.        Given a single string and an argdesc array, sparseargs will
  375.        parse arguments from a string in much the same manner as
  376. --- 39,46 ----
  377.        ``-v\nval'' is a not).
  378.   
  379.        Given an ArgList and an argdesc array, lparseargs will parse
  380. !      arguments in an ArgList in    much the same manner as    par-
  381. !      seargs.
  382.   
  383.        Given a single string and an argdesc array, sparseargs will
  384.        parse arguments from a string in much the same manner as
  385. ***************
  386. *** 56,62 ****
  387.        to    parse, and a (possibly NULL terminated)    list of
  388.        argument-strings and parses them in much the same manner as
  389.        parseargs.     Unlike    sparseargs, vparseargs assumes that all
  390. -      parameters    are already split up into tokens, hence    any
  391.   
  392.   
  393.   
  394. --- 57,62 ----
  395. ***************
  396. *** 71,79 ****
  397.   
  398.   
  399.   
  400. !      whitespace    characters contained in    any of the string-
  401. !      parameters    are used as is (and will be considered a part of
  402. !      an    argument name or value).
  403.   
  404.   
  405.        Given an argdesc array, usage will    print the usage    for the
  406. --- 71,80 ----
  407.   
  408.   
  409.   
  410. !      parameters    are already split up into tokens, hence    any whi-
  411. !      tespace characters    contained in any of the    string-parameters
  412. !      are used as is (and will be considered a part of an argument
  413. !      name or value).
  414.   
  415.   
  416.        Given an argdesc array, usage will    print the usage    for the
  417. ***************
  418. *** 103,109 ****
  419.   
  420.        argTypePtr_t  ad_type;
  421.         This field is    a pointer to a type conversion function
  422. !       (such    as the ones provided in    argtype(3). The    type
  423.         conversion function is responsible for verifying the
  424.         validity of the argument, allocating any necessary
  425.         storage for its internal representation, and converting
  426. --- 104,110 ----
  427.   
  428.        argTypePtr_t  ad_type;
  429.         This field is    a pointer to a type conversion function
  430. !       (such    as the ones provided in    argtype(3)). The type
  431.         conversion function is responsible for verifying the
  432.         validity of the argument, allocating any necessary
  433.         storage for its internal representation, and converting
  434. ***************
  435. *** 121,128 ****
  436.   
  437.        ARBPTR  ad_valp;
  438.         This field is    a generic pointer to the storage used to
  439. !       represent the    internal value of the command-line argu-
  440. !       ment.    It may be a pointer to a number, a boolean value,
  441.   
  442.   
  443.   
  444. --- 122,128 ----
  445.   
  446.        ARBPTR  ad_valp;
  447.         This field is    a generic pointer to the storage used to
  448. !       represent the    internal value of the command-line
  449.   
  450.   
  451.   
  452. ***************
  453. *** 137,163 ****
  454.   
  455.   
  456.   
  457. !       a string, a list, or anything    else for which there
  458. !       exists a corresponding arg-type function to use in the
  459. !       ad_type field. In the    case of    of parseargs(1)    this
  460. !       field    must be    the name of the    corresponding shell vari-
  461. !       able which eventually    hold the value of the argument
  462. !       given    on the command-line.
  463.   
  464.        const char     *ad_prompt;
  465.         This field contains the long-name of the argument and
  466.         an optional description (the description must    be
  467.         separated from the long-name by at least one whitespace
  468. !       characters and may optionally    be enclosed in a set of
  469.         balanced delimiters (such as parentheses, curly-braces,
  470. !       square-brackets, or angle-brackets. If the long-name
  471.         contains any uppercase characters, then the substring
  472.         of long-name consisting of all uppercase characters is
  473. !       used as the argument name and    the entire long-name is
  474. !       used as the name of the argument-value (if a value my
  475. !       be supplied).    The long-name may be matched by    supplying
  476. !       a unique prefix of either the    argument name or the
  477. !       argument-value name.
  478.   
  479.   DEFINING ARGDESC ARRAYS
  480.        When defining an argdesc array, the first item in the list
  481. --- 137,164 ----
  482.   
  483.   
  484.   
  485. !       argument. It may be a    pointer    to a number, a boolean
  486. !       value, a string, a list, or anything else for    which
  487. !       there    exists a corresponding arg-type    function to use
  488. !       in the ad_type field.    In the case of of parseargs(1)
  489. !       this field must be the name of the corresponding shell
  490. !       variable which will eventually hold the value    of the
  491. !       argument given on the    command-line.
  492.   
  493.        const char     *ad_prompt;
  494.         This field contains the long-name of the argument and
  495.         an optional description (the description must    be
  496.         separated from the long-name by at least one whitespace
  497. !       character and    may optionally be enclosed in a    set of
  498.         balanced delimiters (such as parentheses, curly-braces,
  499. !       square-brackets, or angle-brackets). If the long-name
  500.         contains any uppercase characters, then the substring
  501.         of long-name consisting of all uppercase characters is
  502. !       used as the argument keyword and the entire long-name
  503. !       is used as the name of the argument (if a value my be
  504. !       supplied). The long-name may be matched by supplying a
  505. !       unique prefix    of either the argument keyword or the
  506. !       argument name.
  507.   
  508.   DEFINING ARGDESC ARRAYS
  509.        When defining an argdesc array, the first item in the list
  510. ***************
  511. *** 186,197 ****
  512.        ENDOFARGS
  513.          };
  514.   
  515. -      This describes a program accepting    up to three flag argu-
  516. -      ments and one or two positional arguments,    plus a list of
  517. -      additional    file arguments.     Only the first    positional
  518.   
  519.   
  520.   
  521.   Page 3
  522.   
  523.   
  524. --- 187,197 ----
  525.        ENDOFARGS
  526.          };
  527.   
  528.   
  529.   
  530.   
  531.   Page 3
  532.   
  533.   
  534. ***************
  535. *** 203,209 ****
  536.   
  537.   
  538.   
  539. !      argument is required.  The    possible flags (in UNIX) are:
  540.   
  541.        -c    count  An integer repetition count.  This defaults to
  542.              two.
  543. --- 203,212 ----
  544.   
  545.   
  546.   
  547. !      This describes a program accepting    up to three flag argu-
  548. !      ments and one or two positional arguments,    plus a list of
  549. !      additional    file arguments.     Only the first    positional argu-
  550. !      ment is required.    The possible flags (in UNIX) are:
  551.   
  552.        -c    count  An integer repetition count.  This defaults to
  553.              two.
  554. ***************
  555. *** 251,263 ****
  556.         "-x value"); Its mere    presence (or lack thereof) on the
  557.         command-line is sufficient to    determine the necessary
  558.         action(s) to take (as    in "-x").  Boolean argument types
  559. !       and Pseudo-argument types automatically default to ARG-
  560. !       NOVAL.
  561.   
  562. -      ARGVALOPT
  563.   
  564.   
  565.   Page 4
  566.   
  567.   
  568. --- 254,263 ----
  569.         "-x value"); Its mere    presence (or lack thereof) on the
  570.         command-line is sufficient to    determine the necessary
  571.         action(s) to take (as    in "-x").  Boolean argument types
  572. !       and Pseudo-argument types automatically default to
  573.   
  574.   
  575.   
  576.   Page 4
  577.   
  578.   
  579. ***************
  580. *** 269,274 ****
  581. --- 269,277 ----
  582.   
  583.   
  584.   
  585. +       ARGNOVAL.
  586. +      ARGVALOPT
  587.         This flag is used to indicate    that the command-line
  588.         argument takes a value (as in    "-s string" or
  589.         "/str=string") but that the value to this command-line
  590. ***************
  591. *** 318,326 ****
  592.         line.
  593.   
  594.        ARGVALSEP
  595. -       The value to this argument was supplied in a separate
  596. -       argv element from the    argument itself    (as in "-x value"
  597. -       as opposed to    "-xvalue").
  598.   
  599.   
  600.   
  601. --- 321,326 ----
  602. ***************
  603. *** 335,340 ****
  604. --- 335,344 ----
  605.   
  606.   
  607.   
  608. +       The value to this argument was supplied in a separate
  609. +       argv element from the    argument itself    (as in "-x value"
  610. +       as opposed to    "-xvalue").
  611.        ARGKEYWORD
  612.         This argument    was matched as a keyword (long-form) on
  613.         the command-line and not as a    single character.
  614. ***************
  615. *** 383,395 ****
  616.         provided.
  617.   
  618.        arg_description(ad)
  619. -       Return the description string    (or an empty string if no
  620. -       description was given) for this argument.
  621.   
  622. -      ARG_isPOSITIONAL(ad)
  623.   
  624.   
  625.   Page 6
  626.   
  627.   
  628. --- 387,395 ----
  629. ***************
  630. *** 401,406 ****
  631. --- 401,410 ----
  632.   
  633.   
  634.   
  635. +       Return the description string    (or an empty string if no
  636. +       description was given) for this argument.
  637. +      ARG_isPOSITIONAL(ad)
  638.         Evaluates to TRUE if this argument may be positionally
  639.         matched.
  640.   
  641. ***************
  642. *** 449,461 ****
  643.        arrays. The "old-style" is    still accepted (but if used it is
  644.        recommended that the STARTOFARGS macro is used in conjunc-
  645.        tion with ENDOFARGS).  An example use of these macros
  646. -      (which, with one exception, all begin with    ``CMD'') follows:
  647. -       #include <parseargs.h>
  648.   
  649. -       static BOOL bflag = FALSE;
  650.   
  651.   
  652.   Page 7
  653.   
  654.   
  655. --- 453,461 ----
  656. ***************
  657. *** 467,472 ****
  658. --- 467,476 ----
  659.   
  660.   
  661.   
  662. +      (which, with one exception, all begin with    ``CMD'') follows:
  663. +       #include <parseargs.h>
  664. +       static BOOL bflag = FALSE;
  665.         static char *arg1 = CHARNULL;
  666.         static char *arg2 = CHARNULL;
  667.   
  668. ***************
  669. *** 515,524 ****
  670.        keywords to display command-usage for all command-line
  671.        styles.  In Addition, for VMS style commands, the qualifiers
  672.        /INPUT=file, /OUTPUT=file,    and /ERROR=file, may be    used to
  673. -      redirect stdin, stdout, and stderr    (respectively) to a file.
  674. -      For AmigaDOS style    commands, the keyword ``ENDKWDS'' may be
  675. -      used to disable parsing for any more keywords on the
  676. -      command-line.
  677.   
  678.   
  679.   
  680. --- 519,524 ----
  681. ***************
  682. *** 533,538 ****
  683. --- 533,543 ----
  684.   
  685.   
  686.   
  687. +      redirect stdin, stdout, and stderr    (respectively) to a file.
  688. +      For AmigaDOS style    commands, the keyword ``ENDKWDS'' may be
  689. +      used to disable parsing for any more keywords on the
  690. +      command-line.
  691.   SUPPLYING DEFAULT ARGUMENTS
  692.        Programs that use parseargs may be    given default arguments
  693.        under UNIX    and PCs    through    the use    of environment variables
  694. ***************
  695. *** 543,549 ****
  696.        is    parsed.     The command-line will over-ride any options that
  697.        are specified in this environment variable    (except    that
  698.        ARGLISTs and ARGVECs set in ``CMD_ARGS'' will be appended
  699. !      from the command-line
  700.   
  701.        It    is important to    note that the contents of the
  702.        ``CMD_ARGS'' environment variable are NOT expanded    by the
  703. --- 548,554 ----
  704.        is    parsed.     The command-line will over-ride any options that
  705.        are specified in this environment variable    (except    that
  706.        ARGLISTs and ARGVECs set in ``CMD_ARGS'' will be appended
  707. !      from the command-line if they are selected).
  708.   
  709.        It    is important to    note that the contents of the
  710.        ``CMD_ARGS'' environment variable are NOT expanded    by the
  711. ***************
  712. *** 579,593 ****
  713.        Prompt
  714.         Prompt the user for any missing arguments that are
  715.         required on the command-line.    No special escaping or
  716. !       quoting is performed on the user input. Required argu-
  717. !       ments    that expect a list of values will be repeatedly
  718. !       prompted for (one item per line) until a blank line
  719. !       (followed by a carriage return) is entered.
  720.   
  721. -      Ignore
  722.   
  723.   
  724.   Page 9
  725.   
  726.   
  727. --- 584,593 ----
  728.        Prompt
  729.         Prompt the user for any missing arguments that are
  730.         required on the command-line.    No special escaping or
  731. !       quoting is performed on the user input. Required
  732.   
  733.   
  734.   
  735.   Page 9
  736.   
  737.   
  738. ***************
  739. *** 599,609 ****
  740.   
  741.   
  742.   
  743.         Ignore any unrecognized or improperly    specified
  744.         command-line arguments and continue execution    of the
  745.         program. Normally, if    an argument is unmatched (or is
  746. !       improperly specified), a usage message is printed pro-
  747. !       gram execution is terminated.
  748.   
  749.        OptsOnly
  750.         Under    UNIX, setting this flag    will disable the parsing
  751. --- 599,614 ----
  752.   
  753.   
  754.   
  755. +       arguments that expect    a list of values will be repeat-
  756. +       edly prompted    for (one item per line)    until a    blank
  757. +       line (followed by a carriage return) is entered.
  758. +      Ignore
  759.         Ignore any unrecognized or improperly    specified
  760.         command-line arguments and continue execution    of the
  761.         program. Normally, if    an argument is unmatched (or is
  762. !       improperly specified), a usage message is printed and
  763. !       program execution is terminated.
  764.   
  765.        OptsOnly
  766.         Under    UNIX, setting this flag    will disable the parsing
  767. ***************
  768. *** 635,659 ****
  769.         positional argument.
  770.   
  771.        CaseIgnore
  772. !       Setting this flag cause character-case to be ignored
  773.         when attempting to match single-character argument
  774.         names    (i.e. causes "-i" and "-I" will    be considered
  775.         equivalent).
  776.   
  777.        If    the environment    variable ``PARSECNTL'' is empty    or unde-
  778. !      fined, then parsing behavior set by the programmer    is used.
  779. !      If    the programmer has not explicitly used parsecntl(3) to
  780. !      modify the    parsing    behavior, then the default behavior will
  781. !      be    ``Flags1st'' for Unix systems, ``!Prompt + !Ignore'' for
  782. !      AmigaDOS systems, ``CaseIgnore'' for MS-DOS and OS/2 sys-
  783. !      tems, and ``Prompt'' for VMS systems.
  784.   
  785. - USAGE MESSAGES
  786. -      Through the use of    an environment variable    (or a VMS sym-
  787. -      bol), the user may    control    the syntax and the verbosity of
  788.   
  789.   
  790.   Page 10
  791.   
  792.   
  793. --- 640,659 ----
  794.         positional argument.
  795.   
  796.        CaseIgnore
  797. !       Setting this flag causes character-case to be    ignored
  798.         when attempting to match single-character argument
  799.         names    (i.e. causes "-i" and "-I" will    be considered
  800.         equivalent).
  801.   
  802.        If    the environment    variable ``PARSECNTL'' is empty    or unde-
  803. !      fined, then the parsing behavior set by the programmer is
  804. !      used.  If the programmer has not explicitly used par-
  805. !      secntl(3) to modify the parsing behavior, then the    default
  806. !      behavior will be ``Flags1st'' for Unix systems, ``!Prompt +
  807. !      !Ignore'' for AmigaDOS systems, ``CaseIgnore'' for    MS-DOS
  808.   
  809.   
  810.   
  811.   Page 10
  812.   
  813.   
  814. ***************
  815. *** 665,670 ****
  816. --- 665,675 ----
  817.   
  818.   
  819.   
  820. +      and OS/2 systems, and ``Prompt'' for VMS systems.
  821. + USAGE MESSAGES
  822. +      Through the use of    an environment variable    (or a VMS sym-
  823. +      bol), the user may    control    the syntax and the verbosity of
  824.        the command-usage messages    that are printed by parseargs.
  825.        The desired level of verbosity may    be set by defining the
  826.        environment variable ``USAGECNTL" to be a combination of
  827. ***************
  828. *** 712,725 ****
  829.        LongOpts
  830.         Long-option syntax is    displayed.
  831.   
  832. -      KeyWords
  833. -       Same as LongOpts.
  834.   
  835.   
  836.   
  837.   Page 11
  838.   
  839.   
  840. --- 717,725 ----
  841. ***************
  842. *** 731,736 ****
  843. --- 731,739 ----
  844.   
  845.   
  846.   
  847. +      KeyWords
  848. +       Same as LongOpts.
  849.        If    the environment    variable ``USAGECNTL'' is empty    or unde-
  850.        fined, then the default usage level (which    is presently
  851.        ``Verbose + Options'') will be used.
  852. ***************
  853. *** 751,765 ****
  854.        ArgList structure.    L_NEXT returns the address of the next
  855.        item in the list and L_STRING returns the string-value of
  856.        the current list-item.  L_FLAGS return the    arg-flags for a
  857. !      given item    in the list. With non-multivalued, only    the flags
  858. !      in    the argument descriptor    are needed; lists and vectors
  859. !      however need a set    of flags for each item they contain. Once
  860. !      an    arg-list has been created, it may be deallocated using
  861. !      the function listFree. ListFree takes two parameters, the
  862. !      first of which is the address of the first    item in    the arg-
  863. !      list, and the second of which is a    boolean    value that is
  864. !      TRUE only if each value pointed to    by each    item should also
  865. !      be    deallocated.
  866.   
  867.        An    alternative to argument-lists is argument vectors (or
  868.        arg-vectors).  Arg-vectors    use the    ARGVEC flag instead of
  869. --- 754,766 ----
  870.        ArgList structure.    L_NEXT returns the address of the next
  871.        item in the list and L_STRING returns the string-value of
  872.        the current list-item.  L_FLAGS return the    arg-flags for a
  873. !      given item    in the list. With non-multivalued arguments, only
  874. !      the flags in the argument descriptor are needed; lists and
  875. !      vectors however need a set    of flags for each item they con-
  876. !      tain. Once    an arg-list has    been created, it may be    deallo-
  877. !      cated using the function listFree.    ListFree takes one param-
  878. !      eter: first of which is the address of the    first item in the
  879. !      arg-list.
  880.   
  881.        An    alternative to argument-lists is argument vectors (or
  882.        arg-vectors).  Arg-vectors    use the    ARGVEC flag instead of
  883. ***************
  884. *** 782,788 ****
  885.   
  886.         ( StrVec.array[ StrVec.count ] == (char *)NULL )
  887.   
  888. -      is    always true, and character-vectors will    always have an
  889.   
  890.   
  891.   
  892. --- 783,788 ----
  893. ***************
  894. *** 797,802 ****
  895. --- 797,803 ----
  896.   
  897.   
  898.   
  899. +      is    always true, and character-vectors will    always have an
  900.        extra NUL-character at the    end such that:
  901.   
  902.         ( CharVec.array[ CharVec.count ] == '\0' )
  903. ***************
  904. *** 848,854 ****
  905.           printf(    "String[%d]=%s,    flags=%x\n",
  906.               i, StrVec.array[i], StrVec.flags[i] );
  907.   
  908. -          for ( i = 0 ; i < NumVec.count ; i++ )
  909.   
  910.   
  911.   
  912. --- 849,854 ----
  913. ***************
  914. *** 863,868 ****
  915. --- 863,869 ----
  916.   
  917.   
  918.   
  919. +          for ( i = 0 ; i < NumVec.count ; i++ )
  920.           printf(    "Number[%d]=%s,    flags=%x\n",
  921.               i, NumVec.array[i], NumVec.flags[i] );
  922.   
  923. ***************
  924. *** 887,900 ****
  925.        being converted.  Its main    use is to find the location in
  926.        which to store the    converted value, located in
  927.        argd->ad_valp.  The string    value to be converted is passed
  928. !      in    argp (which will be NULL if the    ARGNOVAL flag was set for
  929.        the corresponding entry in    the arg-descriptor table).  The
  930. !      copyf flag    is TRUE    if the argp string value must be copied
  931.        when saved.  Most non-string types    are copied implicitly
  932.        (for example, integer arguments are stored    in binary form,
  933.        so    the original string value need not be saved), so this
  934.        argument can usually be ignored.  Put simply, this    flag is
  935. !      TRUE when argp points to a    temporary buffer area.
  936.   
  937.        If    the type function successfully converts    the value, and
  938.        uses the entire value, it should return TRUE.  If the type
  939. --- 888,901 ----
  940.        being converted.  Its main    use is to find the location in
  941.        which to store the    converted value, located in
  942.        argd->ad_valp.  The string    value to be converted is passed
  943. !      in    vp (which will be NULL if the ARGNOVAL flag was    set for
  944.        the corresponding entry in    the arg-descriptor table).  The
  945. !      copyf flag    is TRUE    if the vp string value must be copied
  946.        when saved.  Most non-string types    are copied implicitly
  947.        (for example, integer arguments are stored    in binary form,
  948.        so    the original string value need not be saved), so this
  949.        argument can usually be ignored.  Put simply, this    flag is
  950. !      TRUE when vp points to a temporary    buffer area.
  951.   
  952.        If    the type function successfully converts    the value, and
  953.        uses the entire value, it should return TRUE.  If the type
  954. ***************
  955. *** 914,920 ****
  956.         #define REALLOC(ptr,size)  ((! ptr) ?    malloc(size) : realloc(ptr, size))
  957.         typedef ARGVEC_T(FILE    *)  FILEvec_t;
  958.   
  959. -       BOOL    argReadFile(  ARGDESC *ad,  char *vp,  BOOL copyf  )
  960.   
  961.   
  962.   
  963. --- 915,920 ----
  964. ***************
  965. *** 929,934 ****
  966. --- 929,935 ----
  967.   
  968.   
  969.   
  970. +       BOOL    argReadFile(  ARGDESC *ad,  char *vp,  BOOL copyf  )
  971.         {
  972.              register    FILE *fp;
  973.              fp = fopen(vp, "r");
  974. ***************
  975. *** 979,986 ****
  976.   
  977.        Under VAX/VMS and AmigaDOS, single-character options are not
  978.        used and the ``long'' name    (in the    prompt field of    an argu-
  979. !      ment descriptor) is always    used to    match for possible argu-
  980. !      ments (or keywords, or qualifiers).
  981.   
  982.   
  983.   
  984. --- 980,986 ----
  985.   
  986.        Under VAX/VMS and AmigaDOS, single-character options are not
  987.        used and the ``long'' name    (in the    prompt field of    an argu-
  988. !      ment descriptor) is always    used to    match for possible
  989.   
  990.   
  991.   
  992. ***************
  993. *** 995,1000 ****
  994. --- 995,1002 ----
  995.   
  996.   
  997.   
  998. +      arguments (or keywords, or    qualifiers).
  999.        For all supported operating systems, a long option    may be
  1000.        matched in    one of two ways: it may    match all uppercase char-
  1001.        acters in the prompt field, or it may match all characters
  1002. ***************
  1003. *** 1045,1052 ****
  1004.        pe_NOMATCH
  1005.         Unable to match the named argument. This occurs when
  1006.         the argument keyword name passed to parsecntl    (using
  1007. -       the pc_ARGFLAGS functions code) was found in the given
  1008. -       argdesc-array    or in its default-list.
  1009.   
  1010.   
  1011.   
  1012. --- 1047,1052 ----
  1013. ***************
  1014. *** 1061,1066 ****
  1015. --- 1061,1069 ----
  1016.   
  1017.   
  1018.   
  1019. +       the pc_ARGFLAGS functions code) was found in the given
  1020. +       argdesc-array    or in its default-list.
  1021.        pe_BADMODE
  1022.         Bad mode for given command in    parsecntl. This    occurs
  1023.         when pc_WRITE    or pc_RDWR mode    is passed to parsecntl in
  1024. ***************
  1025. *** 1110,1121 ****
  1026.        Hence multiple ``leading dash'' arguments may specified as
  1027.        follows:
  1028.   
  1029. -       -f-dash_arg1 -f-dash_arg2  ...
  1030.   
  1031.   
  1032.   
  1033.   Page 17
  1034.   
  1035.   
  1036. --- 1113,1121 ----
  1037. ***************
  1038. *** 1127,1139 ****
  1039.   
  1040.   
  1041.   
  1042.   BUGS
  1043.        When a non-multivalued argument appears more than once on
  1044.        the command-line then only    the last value supplied    is used.
  1045.        A problem occurs however in the following scenario: suppose
  1046. !      `-s' is an    option that takes an optional string argument (nd
  1047. !      suppose `-x' is some boolean flag). Then if the following
  1048. !      command-line is issued:
  1049.   
  1050.         command  -s string  -x  -s
  1051.   
  1052. --- 1127,1141 ----
  1053.   
  1054.   
  1055.   
  1056. +       -f-dash_arg1 -f-dash_arg2  ...
  1057.   BUGS
  1058.        When a non-multivalued argument appears more than once on
  1059.        the command-line then only    the last value supplied    is used.
  1060.        A problem occurs however in the following scenario: suppose
  1061. !      `-s' is an    option that takes an optional string argument
  1062. !      (and suppose `-x' is some boolean flag). Then if the follow-
  1063. !      ing command-line is issued:
  1064.   
  1065.         command  -s string  -x  -s
  1066.   
  1067. ***************
  1068. *** 1159,1166 ****
  1069.        argument flags ARGPOS, ARGVALOPT, ARGVALREQ, ARGVALGIVEN,
  1070.        ARGNOVAL, and ARGVEC; and VAX/VMS version and IBM-PC version
  1071.        by    Brad Appleton
  1072.   
  1073.   
  1074.   
  1075. --- 1161,1166 ----
  1076. No differences encountered
  1077.