home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume17 / parseargs / patch02 / PATCH
Encoding:
Text File  |  1991-03-27  |  37.3 KB  |  822 lines

  1. *** argtype.c.OLD    Tue Mar 26 11:31:00 1991
  2. --- argtype.c    Tue Mar 26 10:19:41 1991
  3. ***************
  4. *** 79,85 ****
  5.   ** ^DESCRIPTION:
  6.   **    Each of these converts a parameter value to the internal form, includ-
  7.   **    ing validity checking.  Their parameters and return values all behave
  8. ! **    similarly. One of these routines are called when an argunent of that
  9.   **    particular type is matched by one of the argument parsing function in
  10.   **    parseargs(3). When such an argument is matched, its argument transla-
  11.   **    tion routines is invoked and is passed (1) the address of the argument
  12. --- 79,85 ----
  13.   ** ^DESCRIPTION:
  14.   **    Each of these converts a parameter value to the internal form, includ-
  15.   **    ing validity checking.  Their parameters and return values all behave
  16. ! **    similarly. One of these routines is called when an argument of that
  17.   **    particular type is matched by one of the argument parsing function in
  18.   **    parseargs(3). When such an argument is matched, its argument transla-
  19.   **    tion routines is invoked and is passed (1) the address of the argument
  20. ***************
  21. *** 151,157 ****
  22.   **    usage to be printed.
  23.   **
  24.   **    ArgDummy is used to force an item to show up in usage-messages but
  25. ! **    the item itself is never matched against any argumenmts from the
  26.   **    command-line.
  27.   **
  28.   **    ArgEnd is used by amiga_args.c and vms_args.c to indicate an argument
  29. --- 151,157 ----
  30.   **    usage to be printed.
  31.   **
  32.   **    ArgDummy is used to force an item to show up in usage-messages but
  33. ! **    the item itself is never matched against any arguments from the
  34.   **    command-line.
  35.   **
  36.   **    ArgEnd is used by amiga_args.c and vms_args.c to indicate an argument
  37. *** doc/argdesc.inc.OLD    Tue Mar 26 11:31:16 1991
  38. --- doc/argdesc.inc    Tue Mar 26 11:01:10 1991
  39. ***************
  40. *** 22,28 ****
  41.   .\"---------------------------------------------
  42.   .IP "\fIargTypePtr_t  ad_type;\fP"
  43.   This field is a pointer to a type conversion function (such as the
  44. ! ones provided in \fIargtype\fP(3). The type conversion function is
  45.   responsible for verifying the validity of the argument, allocating any
  46.   necessary storage for its internal representation, and converting
  47.   the command-line argument into its required internal form. The type
  48. --- 22,28 ----
  49.   .\"---------------------------------------------
  50.   .IP "\fIargTypePtr_t  ad_type;\fP"
  51.   This field is a pointer to a type conversion function (such as the
  52. ! ones provided in \fIargtype\fP(3)). The type conversion function is
  53.   responsible for verifying the validity of the argument, allocating any
  54.   necessary storage for its internal representation, and converting
  55.   the command-line argument into its required internal form. The type
  56. ***************
  57. *** 41,57 ****
  58.   pointer to a number, a boolean value, a string, a list, or anything
  59.   else for which there exists a corresponding arg-type function to
  60.   use in the \fIad_type\fP field. In the case of of \fIparseargs\fP(1) this
  61. ! field must be the name of the corresponding shell variable which eventually
  62. ! hold the value of the argument given on the command-line.
  63.   .\"---------------------------------------------
  64.   .IP "\fIconst char  *ad_prompt;\fP"
  65.   This field contains the long-name of the argument and an optional
  66.   description (the description must be separated from the long-name by
  67. ! at least one whitespace characters and may optionally be enclosed in
  68.   a set of balanced delimiters (such as parentheses, curly-braces,
  69. ! square-brackets, or angle-brackets. If the long-name contains any
  70.   uppercase characters, then the substring of long-name consisting of
  71. ! all uppercase characters is used as the argument name and the entire
  72. ! long-name is used as the name of the argument-value (if a value my be
  73.   supplied). The long-name may be matched by supplying a unique prefix
  74. ! of either the argument name or the argument-value name.
  75. --- 41,57 ----
  76.   pointer to a number, a boolean value, a string, a list, or anything
  77.   else for which there exists a corresponding arg-type function to
  78.   use in the \fIad_type\fP field. In the case of of \fIparseargs\fP(1) this
  79. ! field must be the name of the corresponding shell variable which will
  80. ! eventually hold the value of the argument given on the command-line.
  81.   .\"---------------------------------------------
  82.   .IP "\fIconst char  *ad_prompt;\fP"
  83.   This field contains the long-name of the argument and an optional
  84.   description (the description must be separated from the long-name by
  85. ! at least one whitespace character and may optionally be enclosed in
  86.   a set of balanced delimiters (such as parentheses, curly-braces,
  87. ! square-brackets, or angle-brackets). If the long-name contains any
  88.   uppercase characters, then the substring of long-name consisting of
  89. ! all uppercase characters is used as the argument keyword and the entire
  90. ! long-name is used as the name of the argument (if a value my be
  91.   supplied). The long-name may be matched by supplying a unique prefix
  92. ! of either the argument keyword or the argument name.
  93. *** doc/argtype.man3.OLD    Tue Mar 26 11:31:22 1991
  94. --- doc/argtype.man3    Tue Mar 26 10:24:42 1991
  95. ***************
  96. *** 34,41 ****
  97.   .PP
  98.   Each of these converts a parameter value to the internal form,
  99.   including validity checking.  Their parameters and return values
  100. ! all behave similarly. One of these routines are called when an
  101. ! argunent of that particular type is matched by one of the argument
  102.   parsing function in \fIparseargs\fP(3). When such an argument is matched,
  103.   its argument translation routines is invoked and is passed (1) the address of
  104.   the argument descriptor for the matched argument, (2) the possible argument
  105. --- 34,41 ----
  106.   .PP
  107.   Each of these converts a parameter value to the internal form,
  108.   including validity checking.  Their parameters and return values
  109. ! all behave similarly. One of these routines is called when an
  110. ! argument of that particular type is matched by one of the argument
  111.   parsing function in \fIparseargs\fP(3). When such an argument is matched,
  112.   its argument translation routines is invoked and is passed (1) the address of
  113.   the argument descriptor for the matched argument, (2) the possible argument
  114. ***************
  115. *** 50,56 ****
  116.   the matched argument has the \s-1ARGVEC\s+1 flag enabled). If the argument is
  117.   an \s-1ARGVEC\s+1 or \s-1ARGLIST\s+1 then the routine is responsible for
  118.   allocating any space, copying the arg-flags to the value-specific flags, and
  119. ! setting the \s-1ARGCOPYF\fP flag for the value if it needs to be allocated
  120.   as well.
  121.   
  122.   .SH "RETURN VALUE"
  123. --- 50,56 ----
  124.   the matched argument has the \s-1ARGVEC\s+1 flag enabled). If the argument is
  125.   an \s-1ARGVEC\s+1 or \s-1ARGLIST\s+1 then the routine is responsible for
  126.   allocating any space, copying the arg-flags to the value-specific flags, and
  127. ! setting the \s-1ARGCOPYF\s+1 flag for the value if it needs to be allocated
  128.   as well.
  129.   
  130.   .SH "RETURN VALUE"
  131. ***************
  132. *** 65,71 ****
  133.   The conversion was successful but only \fIN\fP characters of the value
  134.   were used, the remaining characters may still match other arguments.
  135.   
  136. ! .SH "PSEUDO-TYPES"
  137.   .PP
  138.   .I ArgUsage
  139.   is used to specify an argument that causes the command usage to be printed.
  140. --- 65,71 ----
  141.   The conversion was successful but only \fIN\fP characters of the value
  142.   were used, the remaining characters may still match other arguments.
  143.   
  144. ! .SH "PSEUDO-TYPES: argUsage, argDummy, argEnd"
  145.   .PP
  146.   .I ArgUsage
  147.   is used to specify an argument that causes the command usage to be printed.
  148. ***************
  149. *** 72,78 ****
  150.   
  151.   .I ArgDummy
  152.   is used to force an item to show up in usage-messages but
  153. ! the item itself is never matched against any argumenmts from the
  154.   command-line.
  155.   
  156.   .I ArgEnd
  157. --- 72,78 ----
  158.   
  159.   .I ArgDummy
  160.   is used to force an item to show up in usage-messages but
  161. ! the item itself is never matched against any arguments from the
  162.   command-line.
  163.   
  164.   .I ArgEnd
  165. ***************
  166. *** 82,88 ****
  167.   These three are dummy functions. The routines themselves do nothing
  168.   of importance, we just need to have their addresses available for
  169.   identification in the corresponding command-line styles.
  170. ! .SH "STRING-TYPES"
  171.   .PP
  172.   \fIArgStr\fP is one of the few argument translation routines that actually
  173.   uses the \fIcopyf\fP flag. If \fIcopyf\fP is true then the string is
  174. --- 82,88 ----
  175.   These three are dummy functions. The routines themselves do nothing
  176.   of importance, we just need to have their addresses available for
  177.   identification in the corresponding command-line styles.
  178. ! .SH "STRING-TYPES: argStr"
  179.   .PP
  180.   \fIArgStr\fP is one of the few argument translation routines that actually
  181.   uses the \fIcopyf\fP flag. If \fIcopyf\fP is true then the string is
  182. ***************
  183. *** 94,100 ****
  184.   
  185.   \fIArgStr\fP ensures that the very last item in a vector of strings (the one
  186.   accessed as \f4vec.array[ vec.count ]\fP) will always be \s-1NULL\s+1.
  187. ! .SH "CHARACTER-TYPES"
  188.   .PP
  189.   .I ArgChar
  190.   assigns the given character to the value referenced by \fIarg_valp(ad)\fP
  191. --- 94,100 ----
  192.   
  193.   \fIArgStr\fP ensures that the very last item in a vector of strings (the one
  194.   accessed as \f4vec.array[ vec.count ]\fP) will always be \s-1NULL\s+1.
  195. ! .SH "CHARACTER-TYPES: argChar"
  196.   .PP
  197.   .I ArgChar
  198.   assigns the given character to the value referenced by \fIarg_valp(ad)\fP
  199. ***************
  200. *** 109,125 ****
  201.   
  202.   Unlike \fIargStr\fP, \fIargChar\fP will translate character escape sequences
  203.   such as `\\n' and `\\012'.
  204. ! .SH "INTEGER-TYPES"
  205.   .PP
  206.   Each of these functions converts the given string to the desired
  207.   integral type. The value may be specified as an octal number by
  208.   specifying the first digit to be 0. Similarly, If the first two 
  209.   characters are `0x' then the number is treated as hexadecimal.
  210. ! .SH "FLOATING-POINT-TYPES"
  211.   .PP
  212.   Each of these functions converts the given string to the desired
  213.   floating-point type.
  214. ! .SH "BOOLEAN-TYPES"
  215.   .PP
  216.   \fIArgBool\fP and \fIargSBool\fP set a boolean value (if no value is given).
  217.   \fIArgUBool\fP unsets a boolean value (if no value is given). \fIArgTBool\fP
  218. --- 109,125 ----
  219.   
  220.   Unlike \fIargStr\fP, \fIargChar\fP will translate character escape sequences
  221.   such as `\\n' and `\\012'.
  222. ! .SH "INTEGER-TYPES: argInt, argShort, argLong"
  223.   .PP
  224.   Each of these functions converts the given string to the desired
  225.   integral type. The value may be specified as an octal number by
  226.   specifying the first digit to be 0. Similarly, If the first two 
  227.   characters are `0x' then the number is treated as hexadecimal.
  228. ! .SH "FLOATING-POINT-TYPES: argFloat, argDouble"
  229.   .PP
  230.   Each of these functions converts the given string to the desired
  231.   floating-point type.
  232. ! .SH "BOOLEAN-TYPES: argBool, argSBool, argTBool, argUBool"
  233.   .PP
  234.   \fIArgBool\fP and \fIargSBool\fP set a boolean value (if no value is given).
  235.   \fIArgUBool\fP unsets a boolean value (if no value is given). \fIArgTBool\fP
  236. ***************
  237. *** 148,154 ****
  238.   The corresponding boolean flag is set to \s-1FALSE\s+1.
  239.   .IP "``1'', ``+'', ``ON'', or ``TRUE''"
  240.   The corresponding boolean flag is set to \s-1TRUE\s+1.
  241. ! .SH LIST TYPES
  242.   .PP
  243.   The \fIlistStr\fP argument translation routine is only intended for use
  244.   on behalf of arguments that have the \s-1ARGLIST\s+1 flag enabled. It will
  245. --- 148,154 ----
  246.   The corresponding boolean flag is set to \s-1FALSE\s+1.
  247.   .IP "``1'', ``+'', ``ON'', or ``TRUE''"
  248.   The corresponding boolean flag is set to \s-1TRUE\s+1.
  249. ! .SH "LIST TYPES: listStr"
  250.   .PP
  251.   The \fIlistStr\fP argument translation routine is only intended for use
  252.   on behalf of arguments that have the \s-1ARGLIST\s+1 flag enabled. It will
  253. ***************
  254. *** 168,171 ****
  255.   type of the items in the vector.
  256.   .SH SEE ALSO
  257.   .IR parseargs (3),
  258. ! .IR parseargs (1),
  259. --- 168,172 ----
  260.   type of the items in the vector.
  261.   .SH SEE ALSO
  262.   .IR parseargs (3),
  263. ! .IR parseargs (3),
  264. ! .IR parsecntl (1),
  265. *** doc/env_args.inc.OLD    Tue Mar 26 11:31:43 1991
  266. --- doc/env_args.inc    Tue Mar 26 10:42:13 1991
  267. ***************
  268. *** 10,16 ****
  269.   will be parsed for any "default" arguments before the command-line is parsed.
  270.   The command-line will over-ride any options that are specified in this
  271.   environment variable (except that \s-1ARGLIST\s+1s and \s-1ARGVEC\s+1s set in
  272. ! ``\s-1CMD_ARGS\s+1'' will be appended from the command-line
  273.   
  274.   It is important to note that the contents of the ``\s-1\fICMD\fP_ARGS\s+1''
  275.   environment variable are NOT expanded by the shell and hence any special
  276. --- 10,17 ----
  277.   will be parsed for any "default" arguments before the command-line is parsed.
  278.   The command-line will over-ride any options that are specified in this
  279.   environment variable (except that \s-1ARGLIST\s+1s and \s-1ARGVEC\s+1s set in
  280. ! ``\s-1CMD_ARGS\s+1'' will be appended from the command-line if they are
  281. ! selected).
  282.   
  283.   It is important to note that the contents of the ``\s-1\fICMD\fP_ARGS\s+1''
  284.   environment variable are NOT expanded by the shell and hence any special
  285. *** doc/env_parse.inc.OLD    Tue Mar 26 11:31:46 1991
  286. --- doc/env_parse.inc    Tue Mar 26 10:46:48 1991
  287. ***************
  288. *** 25,31 ****
  289.   Ignore any unrecognized or improperly specified command-line arguments
  290.   and continue execution of the program. Normally, if an argument is
  291.   unmatched (or is improperly specified), a usage message is printed
  292. ! program execution is terminated.
  293.   .\"----------------------
  294.   .IP "\fIOptsOnly\fP"
  295.   Under UNIX, setting this flag will disable the parsing of long-option
  296. --- 25,31 ----
  297.   Ignore any unrecognized or improperly specified command-line arguments
  298.   and continue execution of the program. Normally, if an argument is
  299.   unmatched (or is improperly specified), a usage message is printed
  300. ! and program execution is terminated.
  301.   .\"----------------------
  302.   .IP "\fIOptsOnly\fP"
  303.   Under UNIX, setting this flag will disable the parsing of long-option
  304. ***************
  305. *** 53,65 ****
  306.   considered to consist of one option and one positional argument.
  307.   .\"----------------------
  308.   .IP "\fICaseIgnore\fP"
  309. ! Setting this flag cause character-case to be ignored when attempting
  310.   to match single-character argument names (i.e. causes "-i" and "-I"
  311.   will be considered equivalent).
  312.   .sp 4p
  313.   .PP
  314.   If the environment variable ``\s-1PARSECNTL\s+1'' is empty or
  315. ! undefined, then parsing behavior set by the programmer is used.
  316.   If the programmer has not explicitly used
  317.   .IR parsecntl (3)
  318.   to modify the parsing behavior, then the default behavior will be
  319. --- 53,65 ----
  320.   considered to consist of one option and one positional argument.
  321.   .\"----------------------
  322.   .IP "\fICaseIgnore\fP"
  323. ! Setting this flag causes character-case to be ignored when attempting
  324.   to match single-character argument names (i.e. causes "-i" and "-I"
  325.   will be considered equivalent).
  326.   .sp 4p
  327.   .PP
  328.   If the environment variable ``\s-1PARSECNTL\s+1'' is empty or
  329. ! undefined, then the parsing behavior set by the programmer is used.
  330.   If the programmer has not explicitly used
  331.   .IR parsecntl (3)
  332.   to modify the parsing behavior, then the default behavior will be
  333. *** doc/lib_bugs.inc.OLD    Tue Mar 26 11:31:57 1991
  334. --- doc/lib_bugs.inc    Tue Mar 26 11:13:04 1991
  335. ***************
  336. *** 7,13 ****
  337.   When a non-multivalued argument appears more than once on the command-line
  338.   then only the last value supplied is used. A problem occurs however in the
  339.   following scenario: suppose `\fB\-s\fP' is an option that takes an optional
  340. ! string argument (nd suppose `\fB\-x\fP' is some boolean flag). Then if the
  341.   following command-line is issued:
  342.   
  343.   .RS
  344. --- 7,13 ----
  345.   When a non-multivalued argument appears more than once on the command-line
  346.   then only the last value supplied is used. A problem occurs however in the
  347.   following scenario: suppose `\fB\-s\fP' is an option that takes an optional
  348. ! string argument (and suppose `\fB\-x\fP' is some boolean flag). Then if the
  349.   following command-line is issued:
  350.   
  351.   .RS
  352. *** doc/lparseargs3.inc.OLD    Tue Mar 26 11:32:01 1991
  353. --- doc/lparseargs3.inc    Tue Mar 26 10:54:24 1991
  354. ***************
  355. *** 4,7 ****
  356.   .\"----------------------------------------------------------------------------
  357.   .PP
  358.   Given an ArgList and an argdesc array, \fIlparseargs\fP
  359. ! will parse arguments in a file in much the same manner as \fIparseargs\fP.
  360. --- 4,7 ----
  361.   .\"----------------------------------------------------------------------------
  362.   .PP
  363.   Given an ArgList and an argdesc array, \fIlparseargs\fP
  364. ! will parse arguments in an ArgList in much the same manner as \fIparseargs\fP.
  365. *** doc/multivals.inc.OLD    Tue Mar 26 11:32:05 1991
  366. --- doc/multivals.inc    Tue Mar 26 11:08:39 1991
  367. ***************
  368. *** 22,35 ****
  369.   ArgList structure. \s-1L_NEXT\s+1 returns the address of the next item in the
  370.   list and \s-1L_STRING\s+1 returns the string-value of the current list-item.
  371.   \s-1L_FLAGS\s+1 return the arg-flags for a given item in the list. With
  372. ! non-multivalued, only the flags in the argument descriptor are needed; lists
  373. ! and vectors however need a set of flags for each item they contain. 
  374. ! Once an arg-list has been created, it may be deallocated using the function
  375.   .I listFree.
  376.   .I ListFree
  377. ! takes two parameters, the first of which is the address of the first item in
  378. ! the arg-list, and the second of which is a boolean value that is \s-1TRUE\s+1
  379. ! only if each value pointed to by each item should also be deallocated.
  380.   .PP
  381.   An alternative to argument-lists is argument vectors (or arg-vectors).
  382.   Arg-vectors use the \s-1ARGVEC\s+1 flag instead of the \s-1ARGLIST\s+1 flag
  383. --- 22,35 ----
  384.   ArgList structure. \s-1L_NEXT\s+1 returns the address of the next item in the
  385.   list and \s-1L_STRING\s+1 returns the string-value of the current list-item.
  386.   \s-1L_FLAGS\s+1 return the arg-flags for a given item in the list. With
  387. ! non-multivalued arguments, only the flags in the argument descriptor are
  388. ! needed; lists and vectors however need a set of flags for each item they
  389. ! contain. Once an arg-list has been created, it may be deallocated using
  390. ! the function
  391.   .I listFree.
  392.   .I ListFree
  393. ! takes one parameter: first of which is the address of the first item in
  394. ! the arg-list.
  395.   .PP
  396.   An alternative to argument-lists is argument vectors (or arg-vectors).
  397.   Arg-vectors use the \s-1ARGVEC\s+1 flag instead of the \s-1ARGLIST\s+1 flag
  398. *** doc/parseargs.man1.OLD    Tue Mar 26 11:32:11 1991
  399. --- doc/parseargs.man1    Tue Mar 26 10:34:35 1991
  400. ***************
  401. *** 188,194 ****
  402.   the calling program is needed in order for \fBparseargs\fP to be able to
  403.   distinguish options to itself from options for the calling program.
  404.   .PP
  405. ! The default behavior of parseargs is allow both single-character options and
  406.   long-options (keywords) on the command-line. The user may specify that only
  407.   options (long-options) are to be permitted by specifying the \fB\-o\fP
  408.   (\fB\-l\) option on the command-line.
  409. --- 188,194 ----
  410.   the calling program is needed in order for \fBparseargs\fP to be able to
  411.   distinguish options to itself from options for the calling program.
  412.   .PP
  413. ! The default behavior of parseargs is to allow both single-character options and
  414.   long-options (keywords) on the command-line. The user may specify that only
  415.   options (long-options) are to be permitted by specifying the \fB\-o\fP
  416.   (\fB\-l\) option on the command-line.
  417. *** doc/parseargs.man3.OLD    Tue Mar 26 11:32:16 1991
  418. --- doc/parseargs.man3    Tue Mar 26 11:12:33 1991
  419. ***************
  420. *** 12,18 ****
  421.   int  fparseargs(  FILE *fp,  ARGDESC *argd  )
  422.   int  lparseargs(  ArgList *argls,  ARGDESC *argd  )
  423.   int  sparseargs(  char *str,  ARGDESC *argd  )
  424. ! int  vparseargs(  ARGDESC *argd,  ...  )
  425.   void  usage(  const ARGDESC *argd  )
  426.   .fi
  427.   .\"-----------------------------------------------------------
  428. --- 12,18 ----
  429.   int  fparseargs(  FILE *fp,  ARGDESC *argd  )
  430.   int  lparseargs(  ArgList *argls,  ARGDESC *argd  )
  431.   int  sparseargs(  char *str,  ARGDESC *argd  )
  432. ! int  vparseargs(  ARGDESC *argd, int argc,  ...  )
  433.   void  usage(  const ARGDESC *argd  )
  434.   .fi
  435.   .\"-----------------------------------------------------------
  436. ***************
  437. *** 122,134 ****
  438.   Its main use is to find the location in which to store the converted value,
  439.   located in argd\(->ad_valp.
  440.   The string value to be converted is passed in
  441. ! .IR argp
  442.   (which will be \s-1NULL\s+1 if the \s-1ARGNOVAL\s+1 flag was set for the
  443.   corresponding entry in the arg-descriptor table).
  444.   The
  445.   .I copyf
  446.   flag is TRUE if the
  447. ! .I argp
  448.   string value must be copied when saved.
  449.   Most non-string types are copied implicitly
  450.   (for example, integer arguments are stored in binary form,
  451. --- 122,134 ----
  452.   Its main use is to find the location in which to store the converted value,
  453.   located in argd\(->ad_valp.
  454.   The string value to be converted is passed in
  455. ! .IR vp
  456.   (which will be \s-1NULL\s+1 if the \s-1ARGNOVAL\s+1 flag was set for the
  457.   corresponding entry in the arg-descriptor table).
  458.   The
  459.   .I copyf
  460.   flag is TRUE if the
  461. ! .I vp
  462.   string value must be copied when saved.
  463.   Most non-string types are copied implicitly
  464.   (for example, integer arguments are stored in binary form,
  465. ***************
  466. *** 137,143 ****
  467.   Put simply, this flag is
  468.   TRUE
  469.   when
  470. ! .I argp
  471.   points to a temporary buffer area.
  472.   .PP
  473.   If the type function successfully converts the value,
  474. --- 137,143 ----
  475.   Put simply, this flag is
  476.   TRUE
  477.   when
  478. ! .I vp
  479.   points to a temporary buffer area.
  480.   .PP
  481.   If the type function successfully converts the value,
  482. *** doc/parseargs1.inc.OLD    Tue Mar 26 11:32:21 1991
  483. --- doc/parseargs1.inc    Tue Mar 26 10:27:15 1991
  484. ***************
  485. *** 14,20 ****
  486.   extra arguments,
  487.   and argument values that are syntactically incorrect.
  488.   Other behavior such as prompting the user for missing arguments and
  489. ! ignoring as command-line syntax may be specified on the command-line
  490.   through the use of various options, or through the use of the
  491.   ``\s-1PARSECNTL\s+1'' environment variable.
  492.   .PP
  493. --- 14,20 ----
  494.   extra arguments,
  495.   and argument values that are syntactically incorrect.
  496.   Other behavior such as prompting the user for missing arguments and
  497. ! ignoring bad command-line syntax may be specified on the command-line
  498.   through the use of various options, or through the use of the
  499.   ``\s-1PARSECNTL\s+1'' environment variable.
  500.   .PP
  501. *** doc/sh_arrays.inc.OLD    Tue Mar 26 11:32:52 1991
  502. --- doc/sh_arrays.inc    Tue Mar 26 10:39:21 1991
  503. ***************
  504. *** 33,39 ****
  505.   ``\fB*\fP'', then the positional parameters of the calling program
  506.   will be re-assigned to the contents of the argument list.
  507.   .PP
  508. ! For the \fIawk\fP and \fIperl\fP,
  509.   if the variable name corresponding to the \s-1ARGLIST\s+1 argument is
  510.   ``\fBARGV\fP'', then the positional parameters of the calling program
  511.   will be re-assigned to the contents of the argument list.
  512. --- 33,39 ----
  513.   ``\fB*\fP'', then the positional parameters of the calling program
  514.   will be re-assigned to the contents of the argument list.
  515.   .PP
  516. ! For \fIawk\fP and \fIperl\fP,
  517.   if the variable name corresponding to the \s-1ARGLIST\s+1 argument is
  518.   ``\fBARGV\fP'', then the positional parameters of the calling program
  519.   will be re-assigned to the contents of the argument list.
  520. ***************
  521. *** 178,188 ****
  522.   .nf
  523.   .RS
  524.   .ft 4
  525. ! @name=( arg1 , arg2 ,  ... )
  526.   .ft R
  527.   .RE
  528.   .fi
  529. ! .SS ""A Final Note on Argument Lists"
  530.   .PP
  531.   The word-lists used by the C shell, the arrays used by the Korn shell, the 
  532.   Plan 9 shell, \fIawk\fP, \fIperl\fP, and the positional parameters used by
  533. --- 178,188 ----
  534.   .nf
  535.   .RS
  536.   .ft 4
  537. ! @name=( arg1 , arg2 ,  ... );
  538.   .ft R
  539.   .RE
  540.   .fi
  541. ! .SS "A Final Note on Argument Lists"
  542.   .PP
  543.   The word-lists used by the C shell, the arrays used by the Korn shell, the 
  544.   Plan 9 shell, \fIawk\fP, \fIperl\fP, and the positional parameters used by
  545. *** doc/shells.inc.OLD    Tue Mar 26 11:32:55 1991
  546. --- doc/shells.inc    Tue Mar 26 10:31:22 1991
  547. ***************
  548. *** 18,24 ****
  549.   shell syntax to use. At present, \fBparseargs\fP only recognizes
  550.   ``sh'', ``csh'', ``ksh'', ``tcsh'', ``bash'', ``rc'', ``awk'', and ``perl''
  551.   as valid command interpreters. \fIAwk\fP output is slightly different from 
  552. ! that of the other shells in that the actual variable setting are not
  553.   printed but each line of an associative array is printed (the first field
  554.   is the array index, the second is the value for that index).
  555.   If no shell is specified, then the Bourne shell (``sh'') will be assumed.
  556. --- 18,24 ----
  557.   shell syntax to use. At present, \fBparseargs\fP only recognizes
  558.   ``sh'', ``csh'', ``ksh'', ``tcsh'', ``bash'', ``rc'', ``awk'', and ``perl''
  559.   as valid command interpreters. \fIAwk\fP output is slightly different from 
  560. ! that of the other shells in that the actual variable settings are not
  561.   printed but each line of an associative array is printed (the first field
  562.   is the array index, the second is the value for that index).
  563.   If no shell is specified, then the Bourne shell (``sh'') will be assumed.
  564. *** parseargs.c.OLD    Tue Mar 26 11:33:29 1991
  565. --- parseargs.c    Tue Mar 26 10:38:26 1991
  566. ***************
  567. *** 13,19 ****
  568.   **    arguments, converts values to the desired type, and diagnoses problems
  569.   **    such as missing arguments, extra arguments, and argument values that
  570.   **    are syntactically incorrect.  Other behavior such as prompting the
  571. ! **    user for missing arguments and ignoring as command-line syntax may be
  572.   **    specified on the command-line through the use of various options, or
  573.   **    through the use of the "PARSECNTL" environment variable.
  574.   **
  575. --- 13,19 ----
  576.   **    arguments, converts values to the desired type, and diagnoses problems
  577.   **    such as missing arguments, extra arguments, and argument values that
  578.   **    are syntactically incorrect.  Other behavior such as prompting the
  579. ! **    user for missing arguments and ignoring bad command-line syntax may be
  580.   **    specified on the command-line through the use of various options, or
  581.   **    through the use of the "PARSECNTL" environment variable.
  582.   **
  583. ***************
  584. *** 158,164 ****
  585.   **    to use. At present, parseargs only recognizes "sh", "csh", "ksh",
  586.   **    "tcsh", "bash", "rc", "awk", and "perl" as valid command interpreters.
  587.   **    Awk output is slightly different from that of the other shells in that
  588. ! **    the actual variable setting are not printed but each line of an
  589.   **    associative array is printed (the first field is the array index, the
  590.   **    second is the value for that index).  If no shell is specified, then
  591.   **    the Bourne shell ("sh") will be assumed.
  592. --- 158,164 ----
  593.   **    to use. At present, parseargs only recognizes "sh", "csh", "ksh",
  594.   **    "tcsh", "bash", "rc", "awk", and "perl" as valid command interpreters.
  595.   **    Awk output is slightly different from that of the other shells in that
  596. ! **    the actual variable settings are not printed but each line of an
  597.   **    associative array is printed (the first field is the array index, the
  598.   **    second is the value for that index).  If no shell is specified, then
  599.   **    the Bourne shell ("sh") will be assumed.
  600. ***************
  601. *** 1578,1584 ****
  602.   **    For perl, each argument list is considered an array and is set using
  603.   **    the following syntax:
  604.   **
  605. ! **         @name=( arg1 , arg2 ,  ... )
  606.   **
  607.   ** ^A_Final_Note_on_Argument_Lists:
  608.   **    The word-lists used by the C shell, the arrays used by the Korn shell,
  609. --- 1578,1584 ----
  610.   **    For perl, each argument list is considered an array and is set using
  611.   **    the following syntax:
  612.   **
  613. ! **         @name=( arg1 , arg2 ,  ... );
  614.   **
  615.   ** ^A_Final_Note_on_Argument_Lists:
  616.   **    The word-lists used by the C shell, the arrays used by the Korn shell,
  617. *** parseargs.h.OLD    Tue Mar 26 11:33:56 1991
  618. --- parseargs.h    Tue Mar 26 11:10:05 1991
  619. ***************
  620. *** 70,76 ****
  621.   */ 
  622.      BOOL (*ad_type) ARGS((struct _argdesc *, char *, BOOL));
  623.   /*    -- This field is a pointer to a type conversion function (such as the
  624. ! **       ones provided in argtype(3). The type conversion function is respon-
  625.   **       sible for verifying the validity of the argument, allocating any
  626.   **       necessary storage for its internal representation, and converting
  627.   **       the command-line argument into its required internal form. The type
  628. --- 70,76 ----
  629.   */ 
  630.      BOOL (*ad_type) ARGS((struct _argdesc *, char *, BOOL));
  631.   /*    -- This field is a pointer to a type conversion function (such as the
  632. ! **       ones provided in argtype(3)). The type conversion function is respon-
  633.   **       sible for verifying the validity of the argument, allocating any
  634.   **       necessary storage for its internal representation, and converting
  635.   **       the command-line argument into its required internal form. The type
  636. ***************
  637. *** 89,108 ****
  638.   **       pointer to a number, a boolean value, a string, a list, or anything
  639.   **       else for which there exists a corresponding arg-type function to
  640.   **       use in the ad_type field. In the case of of parseargs(1) this field
  641. ! **       must be the name of the corresponding shell variable which eventually
  642. ! **       hold the value of the argument given on the command-line.
  643.   */ 
  644.      CONST char *ad_prompt;
  645.   /*    -- This field contains the long-name of the argument and an optional
  646.   **       description (the description must be separated from the long-name by
  647. ! **       at least one whitespace characters and may optionally be enclosed in
  648.   **       a set of balanced delimiters (such as parentheses, curly-braces,
  649. ! **       square-brackets, or angle-brackets. If the long-name contains any
  650.   **       uppercase characters, then the substring of long-name consisting of
  651. ! **       all uppercase characters is used as the argument name and the entire
  652. ! **       long-name is used as the name of the argument-value (if a value my be
  653. ! **       supplied). The long-name may be matched by supplying a unique prefix
  654. ! **       of either the argument name or the argument-value name.
  655.   */ 
  656.   } ARGDESC;
  657.   /**^^**********************************************************************/
  658. --- 89,108 ----
  659.   **       pointer to a number, a boolean value, a string, a list, or anything
  660.   **       else for which there exists a corresponding arg-type function to
  661.   **       use in the ad_type field. In the case of of parseargs(1) this field
  662. ! **       must be the name of the corresponding shell variable which will
  663. ! **       eventually hold the value of the argument given on the command-line.
  664.   */ 
  665.      CONST char *ad_prompt;
  666.   /*    -- This field contains the long-name of the argument and an optional
  667.   **       description (the description must be separated from the long-name by
  668. ! **       at least one whitespace character and may optionally be enclosed in
  669.   **       a set of balanced delimiters (such as parentheses, curly-braces,
  670. ! **       square-brackets, or angle-brackets). If the long-name contains any
  671.   **       uppercase characters, then the substring of long-name consisting of
  672. ! **       all uppercase characters is used as the argument keyword and the
  673. ! **       entire long-name is used as the name of the argument (if a value may
  674. ! **       be supplied). The long-name may be matched by supplying a unique
  675. ! **       prefix of either the argument keyword or the argument name.
  676.   */ 
  677.   } ARGDESC;
  678.   /**^^**********************************************************************/
  679. ***************
  680. *** 419,433 ****
  681.   **    ARGLISTNULL is simply the NULL argument-list pointer.  L_NEXT and
  682.   **    L_STRING each take a pointer to a non-NULL ArgList structure. L_NEXT
  683.   **    returns the address of the next item in the list and L_STRING returns
  684. ! **    the string-value of the current list-item.  L_FLAGS return the arg-
  685. ! **    flags for a given item in the list. With non-multivalued, only the
  686.   **    flags in the argument descriptor are needed; lists and vectors however
  687.   **    need a set of flags for each item they contain. Once an arg-list has
  688.   **    been created, it may be deallocated using the function listFree. List-
  689. ! **    Free takes two parameters, the first of which is the address of the
  690. ! **    first item in the arg-list, and the second of which is a boolean value
  691. ! **    that is TRUE only if each value pointed to by each item should also be
  692. ! **    deallocated.
  693.   **
  694.   **    An alternative to argument-lists is argument vectors (or arg-vectors).
  695.   **    Arg-vectors use the ARGVEC flag instead of the ARGLIST flag and do not
  696. --- 419,430 ----
  697.   **    ARGLISTNULL is simply the NULL argument-list pointer.  L_NEXT and
  698.   **    L_STRING each take a pointer to a non-NULL ArgList structure. L_NEXT
  699.   **    returns the address of the next item in the list and L_STRING returns
  700. ! **    the string-value of the current list-item.  L_FLAGS return the argflags
  701. ! **    for a given item in the list. With non-multivalued arguments, only the
  702.   **    flags in the argument descriptor are needed; lists and vectors however
  703.   **    need a set of flags for each item they contain. Once an arg-list has
  704.   **    been created, it may be deallocated using the function listFree. List-
  705. ! **    Free takes one parameter: the address of the first item in the arg-list.
  706.   **
  707.   **    An alternative to argument-lists is argument vectors (or arg-vectors).
  708.   **    Arg-vectors use the ARGVEC flag instead of the ARGLIST flag and do not
  709. *** test.rc.OLD    Tue Mar 26 11:35:44 1991
  710. --- test.rc    Mon Mar 25 09:47:08 1991
  711. ***************
  712. *** 21,34 ****
  713.   yflag='TRUE'     ## set defaults (dir="."; count=1; sepch=',') ##
  714.   
  715.   ## parse command-line and save assignments in a temporary file ##
  716. ! parseargs -s rc -e ARGUMENTS -u -- $^NAME "$@" >/tmp/tmp$$
  717.   if ( $status != 0 ) {
  718. !   rm -f /tmp/tmp$$;
  719.     exit 2  ## non-zero status (usage given)
  720.   }
  721.   
  722.   ## evaluate results from parseargs and remove temporary file
  723. ! . /tmp/tmp$$;  rm -f /tmp/tmp$$
  724.   
  725.   ## echo  the parsed arguments (use defaults if not defined)
  726.   echo 'ARGUMENTS:'
  727. --- 21,34 ----
  728.   yflag='TRUE'     ## set defaults (dir="."; count=1; sepch=',') ##
  729.   
  730.   ## parse command-line and save assignments in a temporary file ##
  731. ! parseargs -s rc -e ARGUMENTS -u -- $^NAME $@ >/tmp/tmp$pid
  732.   if ( $status != 0 ) {
  733. !   rm -f /tmp/tmp$pid;
  734.     exit 2  ## non-zero status (usage given)
  735.   }
  736.   
  737.   ## evaluate results from parseargs and remove temporary file
  738. ! . /tmp/tmp$pid;  rm -f /tmp/tmp$pid
  739.   
  740.   ## echo  the parsed arguments (use defaults if not defined)
  741.   echo 'ARGUMENTS:'
  742. *** xparse.c.OLD    Tue Mar 26 11:36:41 1991
  743. --- xparse.c    Tue Mar 26 11:12:58 1991
  744. ***************
  745. *** 63,69 ****
  746.   **    When a non-multivalued argument appears more than once on the
  747.   **    command-line then only the last value supplied is used. A problem
  748.   **    occurs however in the following scenario: suppose `-s' is an option
  749. ! **    that takes an optional string argument (nd suppose `-x' is some
  750.   **    boolean flag). Then if the following command-line is issued:
  751.   **
  752.   **         command  -s string  -x  -s
  753. --- 63,69 ----
  754.   **    When a non-multivalued argument appears more than once on the
  755.   **    command-line then only the last value supplied is used. A problem
  756.   **    occurs however in the following scenario: suppose `-s' is an option
  757. ! **    that takes an optional string argument (and suppose `-x' is some
  758.   **    boolean flag). Then if the following command-line is issued:
  759.   **
  760.   **         command  -s string  -x  -s
  761. ***************
  762. *** 1143,1149 ****
  763.   **                       command-line arguments and continue execution of
  764.   **                       the program. Normally, if an argument is unmatched
  765.   **                       (or is improperly specified), a usage message is
  766. ! **                       printed program execution is terminated.
  767.   **
  768.   **         "OptsOnly"    Under UNIX, setting this flag will disable the
  769.   **                       parsing of long-option syntax. This will cause all
  770. --- 1143,1149 ----
  771.   **                       command-line arguments and continue execution of
  772.   **                       the program. Normally, if an argument is unmatched
  773.   **                       (or is improperly specified), a usage message is
  774. ! **                       printed and program execution is terminated.
  775.   **
  776.   **         "OptsOnly"    Under UNIX, setting this flag will disable the
  777.   **                       parsing of long-option syntax. This will cause all
  778. ***************
  779. *** 1171,1182 ****
  780.   **                       examples are considered to consist of one option
  781.   **                       and one positional argument.
  782.   **
  783. ! **         "CaseIgnore"  Setting this flag cause character-case to be
  784.   **                       ignored when attempting to match single-character
  785.   **                       argument names (i.e. causes "-i" and "-I" will be
  786.   **                       considered equivalent).
  787.   **
  788. ! **    If the environment variable "PARSECNTL" is empty or undefined, then
  789.   **    parsing behavior set by the programmer is used.  If the programmer has
  790.   **    not explicitly used parsecntl(3) to modify the parsing behavior, then
  791.   **    the default behavior will be "Flags1st" for Unix Systems,
  792. --- 1171,1182 ----
  793.   **                       examples are considered to consist of one option
  794.   **                       and one positional argument.
  795.   **
  796. ! **         "CaseIgnore"  Setting this flag causes character-case to be
  797.   **                       ignored when attempting to match single-character
  798.   **                       argument names (i.e. causes "-i" and "-I" will be
  799.   **                       considered equivalent).
  800.   **
  801. ! **    If the environment variable "PARSECNTL" is empty or undefined, then the
  802.   **    parsing behavior set by the programmer is used.  If the programmer has
  803.   **    not explicitly used parsecntl(3) to modify the parsing behavior, then
  804.   **    the default behavior will be "Flags1st" for Unix Systems,
  805. ***************
  806. *** 1997,2003 ****
  807.     
  808.   /* ^DESCRIPTION:
  809.   **    Given an ArgList and an argdesc array, lparseargs will parse arguments
  810. ! **    in a file in much the same manner as parseargs.
  811.   **
  812.   ** ^REQUIREMENTS:
  813.   **    <argls> should be an ArgList of strings
  814. --- 1997,2003 ----
  815.     
  816.   /* ^DESCRIPTION:
  817.   **    Given an ArgList and an argdesc array, lparseargs will parse arguments
  818. ! **    in an ArgList in much the same manner as parseargs.
  819.   **
  820.   ** ^REQUIREMENTS:
  821.   **    <argls> should be an ArgList of strings
  822.