home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume20 / parseargs / patch07 / PATCH07
Encoding:
Text File  |  1991-07-17  |  9.8 KB  |  252 lines

  1. *** Intro.OLD    Mon Jul 15 10:28:10 1991
  2. --- Intro    Wed Jun  5 10:38:05 1991
  3. ***************
  4. *** 73,79 ****
  5.    Once the above array/string is declared it is a simple matter to invoke
  6.    parseargs from C as in the following example:
  7.   
  8. !     status = parseargs( argdesc_array, argv );
  9.   
  10.    or from a shell script as in the following example:
  11.   
  12. --- 73,79 ----
  13.    Once the above array/string is declared it is a simple matter to invoke
  14.    parseargs from C as in the following example:
  15.   
  16. !     status = parseargs( argv, argdesc_array );
  17.   
  18.    or from a shell script as in the following example:
  19.   
  20. *** README.OLD    Mon Jul 15 10:28:33 1991
  21. --- README    Fri Jun 21 10:10:30 1991
  22. ***************
  23. *** 332,338 ****
  24.    name for shell scripts. Furthermore, I changed the contents of USAGECNTL
  25.    from a number to a sequence of mnemonic strings (for better readability).
  26.    I also made USAGECNTL control whether or not a command-description is
  27. !  printed and whther or not the message is piped to a pager on Unix.
  28.   
  29.    Under VMS, the global symbol USAGECNTL is used in lieu of an environment
  30.    variable.  See the parseargs(3) and parseargs(1) manual pages for more
  31. --- 332,338 ----
  32.    name for shell scripts. Furthermore, I changed the contents of USAGECNTL
  33.    from a number to a sequence of mnemonic strings (for better readability).
  34.    I also made USAGECNTL control whether or not a command-description is
  35. !  printed and whether or not the message is piped to a pager on Unix.
  36.   
  37.    Under VMS, the global symbol USAGECNTL is used in lieu of an environment
  38.    variable.  See the parseargs(3) and parseargs(1) manual pages for more
  39. ***************
  40. *** 360,367 ****
  41.    Programs that use parseargs may be given default arguments under UNIX
  42.    and PCs through the use of environment variables (symbols are used for
  43.    VMS systems). If a C-program or a shell-script uses parseargs to imple-
  44. !  ment a command named "foo" then the environment variable (or global
  45. !  synbol) FOO_ARGS will be parsed for any "default" arguments before argv
  46.    is parsed.  Argv will over-ride any options that are specified in
  47.    FOO_ARGS (except that ARGLISTs and ARGVECs set in FOO_ARGS will be
  48.    appended from argv[]).
  49. --- 360,367 ----
  50.    Programs that use parseargs may be given default arguments under UNIX
  51.    and PCs through the use of environment variables (symbols are used for
  52.    VMS systems). If a C-program or a shell-script uses parseargs to imple-
  53. !  -ment a command named "foo" then the environment variable (or global
  54. !  symbol) FOO_ARGS will be parsed for any "default" arguments before argv
  55.    is parsed.  Argv will over-ride any options that are specified in
  56.    FOO_ARGS (except that ARGLISTs and ARGVECs set in FOO_ARGS will be
  57.    appended from argv[]).
  58. ***************
  59. *** 765,770 ****
  60. --- 765,797 ----
  61.    AT&T Unix Systems using both ANSI and non-ANSI C Compilers.
  62.   
  63.   
  64. +  COMPILE-TIME CONSTANTS
  65. +  ======================
  66. +  If any of the following macros are #defined at compile time then they will
  67. +  have the following effect:
  68. +     USE_PAGER    --  for Unix systems only. Parseargs will include the code
  69. +                      which pipes usage messages to a paging program
  70. +     NOFLOAT      --  Parseargs will NOT include the code for the predefined
  71. +                      floating point arg-types argFloat() and argDouble().
  72. +     SVR4         --  Parseargs(1) with the -M option will generate the new
  73. +                      Style Unix manual template.
  74. +     USE_CURSES
  75. +     USE_TERMINFO
  76. +     USE_TERMCAP  --  Parseargs will use curses/terminfo/termcap when trying
  77. +                      to figure out the size of the screen.
  78. +     UNWRITABLE_STRING_LITERALS
  79. +                  --  This should be used only for compilers and/or machines
  80. +                      that do NOT allow the programmer to modify the contents
  81. +                      of string literals such as "hello, world". If this
  82. +                      constant is #defined, then all modified strings will be
  83. +                      duplicated (using strdup()) before they are changed.
  84.    IBM-PC VERSION OF parseargs(3)
  85.    ==============================
  86.    I also added ibm_args.c for MS-DOS and OS/2.
  87. ***************
  88. *** 794,803 ****
  89.    ===============================
  90.    I also added vms_args.c for VAX/VMS.
  91.   
  92. !  VMS_ARGS.C HAS NOT BEEN TESTED ON A VMS SYSTEM!!! I did not have one
  93. !  to test it on. It should accept command-line arguments as described in
  94. !  the "Grammar Rules" section of the VAX manual but I  cant guarantee
  95. !  anything so you'll have to test it out for yourself.
  96.   
  97.    ARGLIST and ARGVEC are comma-separated lists in the VMS version of
  98.    parseargs (not whitespace separated lists). In order to preserve a
  99. --- 821,831 ----
  100.    ===============================
  101.    I also added vms_args.c for VAX/VMS.
  102.   
  103. !  vms_args.c has been tested by people (other than myself) on a VAX/VMS
  104. !  system and seems to work okay. It does not use the CLI$XXXXX routines
  105. !  for parsing. It should accept command-line arguments as described in
  106. !  the "Grammar Rules" section of the VAX manual with one slight exception
  107. !  which is noted below.
  108.   
  109.    ARGLIST and ARGVEC are comma-separated lists in the VMS version of
  110.    parseargs (not whitespace separated lists). In order to preserve a
  111. ***************
  112. *** 890,901 ****
  113.   
  114.    Thanx also to Jim Barbour for helping me with some VMS specific things
  115.    (like getting the original, unparsed command-line from DCL and
  116. !  retreiving the value of a symbol), and to Tom Christiansen and Raymond
  117.    Chen for their help in getting parseargs(1) to work for perl scripts.
  118.   
  119. !  Thanx also to Gillmer J. Derge, Marco Nijdam, & Chris Johnston for sending
  120. !  me their bug reports and fixes so that I could incorporate them into the
  121. !  latest patch of parseargs.
  122.   
  123.    Lastly, thanks to all those who use and will continue to improve
  124.    parseargs, all I ask is that you keep me updated of your efforts (so I
  125. --- 918,929 ----
  126.   
  127.    Thanx also to Jim Barbour for helping me with some VMS specific things
  128.    (like getting the original, unparsed command-line from DCL and
  129. !  retrieving the value of a symbol), and to Tom Christiansen and Raymond
  130.    Chen for their help in getting parseargs(1) to work for perl scripts.
  131.   
  132. !  Thanx also to Gillmer J. Derge, Marco Nijdam, Chris Johnston, & Earl Chew
  133. !  for sending me their bug reports and fixes so that I could incorporate them
  134. !  into the latest patch of parseargs.
  135.   
  136.    Lastly, thanks to all those who use and will continue to improve
  137.    parseargs, all I ask is that you keep me updated of your efforts (so I
  138. *** doc/parseargs.man1.OLD    Mon Jul 15 10:30:33 1991
  139. --- doc/parseargs.man1    Tue Jun 18 17:10:00 1991
  140. ***************
  141. *** 219,225 ****
  142.   message printed and execution terminated). Specifying \fB\-1\fP will force
  143.   all non-positional parameters to precede any positional parameters on the
  144.   command-line (hence anything on the command-line after a positional parameter
  145. ! that resembles a keyword parameter will nevertheles be interpreted as a
  146.   positional parameter).
  147.   .\"----------------------------------------------------------------
  148.   .so argvalopt.inc
  149. --- 219,225 ----
  150.   message printed and execution terminated). Specifying \fB\-1\fP will force
  151.   all non-positional parameters to precede any positional parameters on the
  152.   command-line (hence anything on the command-line after a positional parameter
  153. ! that resembles a keyword parameter will nevertheless be interpreted as a
  154.   positional parameter).
  155.   .\"----------------------------------------------------------------
  156.   .so argvalopt.inc
  157. *** patchlevel.h.OLD    Mon Jul 15 10:32:11 1991
  158. --- patchlevel.h    Mon Jul 15 10:18:26 1991
  159. ***************
  160. *** 2,7 ****
  161. --- 2,18 ----
  162.   ** ^FILE: patchlevel.h - current patchlevel for parseargs
  163.   **
  164.   ** ^HISTORY:
  165. + **    06/05/91    Brad Appleton    <brad@ssd.csd.harris.com>
  166. + **    Patch07
  167. + **    - fixed the "Intro" file to correctly show how to invoke parseargs(3)
  168. + **      (the arguments where in the wrong order).
  169. + **    - added stuff in #ifdef UNWRITABLE_STRING_LITERALS to work for machines
  170. + **      and compilers that dont allow the programmer to modify string literals.
  171. + **    - documented in the README file, all the various compile-time constants
  172. + **      that may change the behavior of parseargs.
  173. + **    - sparseargs neglected to free the argument-vector when it was done
  174. + **      using it.
  175. + **
  176.   **    05/11/91    Brad Appleton    <brad@ssd.csd.harris.com>
  177.   **    Patch06
  178.   **    - parsecntl(3) now correctly handles mispelled keywords for the
  179. ***************
  180. *** 80,86 ****
  181.   
  182.   #define  VERSION     2
  183.   #define  REVISION    0
  184. ! #define  PATCHLEVEL  6
  185.   
  186.   #ifdef __STDC__
  187.      static const char
  188. --- 91,97 ----
  189.   
  190.   #define  VERSION     2
  191.   #define  REVISION    0
  192. ! #define  PATCHLEVEL  7
  193.   
  194.   #ifdef __STDC__
  195.      static const char
  196. ***************
  197. *** 87,90 ****
  198.   #else
  199.      static char
  200.   #endif
  201. !    _Ident[] = "@(#)parseargs  2.0  patchlevel 6";
  202. --- 98,101 ----
  203.   #else
  204.      static char
  205.   #endif
  206. !    _Ident[] = "@(#)parseargs  2.0  patchlevel 7";
  207. *** xparse.c.OLD    Mon Jul 15 10:33:49 1991
  208. --- xparse.c    Wed Jun 19 09:38:14 1991
  209. ***************
  210. *** 542,547 ****
  211. --- 542,551 ----
  212.         if (ARG_isBOOLEAN(ad) || ARG_isPSEUDOARG(ad))
  213.            BSET( arg_flags(ad), ARGNOVAL );
  214.   
  215. + #ifdef UNWRITABLE_STRING_LITERALS
  216. +       ad->ad_prompt = strdup( ad->ad_prompt );
  217. + #endif
  218.         description = get_description( (char *)arg_sname(ad) );
  219.         if ( description )  {
  220.            BSET(arg_flags(ad), ARGDESCRIBED);
  221. ***************
  222. *** 576,581 ****
  223. --- 580,589 ----
  224.      }
  225.   #endif
  226.   
  227. + #ifdef UNWRITABLE_STRING_LITERALS
  228. +    cmd_name(argd) = strdup( cmd_name(argd) );
  229. + #endif
  230.        /* if new-style, get the purpose from the command name */
  231.      if ( !old_style  &&  cmd_name(argd) ) {
  232.         purpose = get_description( (char *)cmd_name(argd) );
  233. ***************
  234. *** 1881,1886 ****
  235. --- 1889,1895 ----
  236.      }
  237.   
  238.      rc = parse_argv_style( argv, parse_init( &argd ) );
  239. +    free( argv );
  240.   
  241.         /* scan for missing required arguments */
  242.      if ( SYNTAX_ERROR(rc, argd) ) {
  243.