home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume30 / parsearg / patch12 < prev    next >
Encoding:
Text File  |  1992-06-20  |  12.5 KB  |  342 lines

  1. Newsgroups: comp.sources.misc
  2. From: brad@hcx1.ssd.csd.harris.com (Brad Appleton)
  3. Subject: v30i072: parseargs - functions to parse command line arguments, Patch12
  4. Message-ID: <1992Jun20.172839.3412@sparky.imd.sterling.com>
  5. X-Md4-Signature: 0a84aaa4ee17c3aa804c021c442a30ba
  6. Date: Sat, 20 Jun 1992 17:28:39 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: brad@hcx1.ssd.csd.harris.com (Brad Appleton)
  10. Posting-number: Volume 30, Issue 72
  11. Archive-name: parseargs/patch12
  12. Environment: UNIX, VMS, MS-DOS, OS/2, Amiga
  13. Patch-To: parseargs: Volume 29, Issue 115-125
  14.  
  15. This is patchlevel twelve of parseargs. It fixes a minor bug in
  16. strfuncs.h and attempts to add Tcl to the list of shells supported
  17. by parseargs(1).
  18.  
  19. To apply this patch:
  20.  
  21. 1) cd to your parseargs source directory
  22. 2) unshar this file to create the file PATCH12
  23. 3) type "patch -p0 < PATCH12
  24.  
  25.  ______________________ "And miles to go before I sleep." ______________________
  26.  Brad Appleton                         Harris Corp., Computer Systems Division
  27.    Senior Software Engineer            2101 West Cypress Creek Road,  M/S 161 
  28.      brad@ssd.csd.harris.com           Fort Lauderdale, FL  33309-1892  USA
  29.        ...!uunet!travis!brad                 Phone: (305) 973-5190
  30.  ~~~~~~~~~~~~~~~~~~~~ Disclaimer: I said it, not my company! ~~~~~~~~~~~~~~~~~~~
  31. ------
  32. #! /bin/sh
  33. # This is a shell archive.  Remove anything before this line, then unpack
  34. # it by saving it into a file and typing "sh file".  To overwrite existing
  35. # files, type "sh file -c".  You can also feed this as standard input via
  36. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  37. # will see the following message at the end:
  38. #        "End of shell archive."
  39. # Contents:  PATCH12
  40. # Wrapped by brad@hcx1 on Mon Jun 15 09:52:14 1992
  41. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  42. if test -f 'PATCH12' -a "${1}" != "-c" ; then 
  43.   echo shar: Will not clobber existing file \"'PATCH12'\"
  44. else
  45. echo shar: Extracting \"'PATCH12'\" \(10305 characters\)
  46. sed "s/^X//" >'PATCH12' <<'END_OF_FILE'
  47. X*** Makefile.OLD    Thu May 21 11:06:41 1992
  48. X--- Makefile    Mon May 18 12:15:47 1992
  49. X***************
  50. X*** 22,28 ****
  51. X  LOCAL =  /usr/local
  52. X  LIBDIR = ${LOCAL}/lib
  53. X  INCDIR = ${LOCAL}/include
  54. X! PERLLIB = ${LIB}/perl
  55. X  
  56. X  ###
  57. X  # compilation options
  58. X--- 22,28 ----
  59. X  LOCAL =  /usr/local
  60. X  LIBDIR = ${LOCAL}/lib
  61. X  INCDIR = ${LOCAL}/include
  62. X! PERLLIB = ${LIBDIR}/perl
  63. X  
  64. X  ###
  65. X  # compilation options
  66. X***************
  67. X*** 101,107 ****
  68. X          doc/vparseargs3.inc
  69. X  SCRIPTS =    test.sh  test.csh  test.ksh  test.rc  test.awk  test.pl
  70. X  PERLSUB =    ${NAME}.pl
  71. X! XXFILES =    Intro  README  MANIFEST  Makefile  Makefile.cpp
  72. X  
  73. X  HDRS =    ${NAME}.h \
  74. X          patchlevel.h \
  75. X--- 101,107 ----
  76. X          doc/vparseargs3.inc
  77. X  SCRIPTS =    test.sh  test.csh  test.ksh  test.rc  test.awk  test.pl
  78. X  PERLSUB =    ${NAME}.pl
  79. X! XXFILES =    Intro  README  MANIFEST  Makefile  VMSbuild.com
  80. X  
  81. X  HDRS =    ${NAME}.h \
  82. X          patchlevel.h \
  83. X*** doc/sh_arrays.inc.OLD    Thu May 21 11:07:07 1992
  84. X--- doc/sh_arrays.inc    Mon May 18 11:54:44 1992
  85. X***************
  86. X*** 199,210 ****
  87. X  .ft R
  88. X  .RE
  89. X  .fi
  90. X  .SS "A Final Note on Argument Lists"
  91. X  .PP
  92. X! The word-lists used by the C and Z shells, the arrays used by the Korn shell,
  93. X! the Plan 9 shell, \fIawk\fP, \fIperl\fP, and the positional parameters used by
  94. X! all shells (if overwritten by \fBparseargs\fP) will preserve any \s-1IFS\s+1
  95. X! characters in their contents.  That is to say that if an item in one of the
  96. X! aforementioned multi-word lists contains any \s-1IFS\s+1 characters, it will
  97. X! not be split up into multiple items but will remain a single item which
  98. X! contains \s-1IFS\s+1 characters.
  99. X--- 199,221 ----
  100. X  .ft R
  101. X  .RE
  102. X  .fi
  103. X+ .SS "Tcl Argument Lists"
  104. X+ .PP
  105. X+ For \fItcl\fP, each argument list is considered a list and is set using 
  106. X+ the following syntax:
  107. X+ .nf
  108. X+ .RS
  109. X+ .ft 4
  110. X+ set name [ list 'arg1'  'arg2'   ... ] ;
  111. X+ .ft R
  112. X+ .RE
  113. X+ .fi
  114. X  .SS "A Final Note on Argument Lists"
  115. X  .PP
  116. X! The word-lists used by the \fIcsh\fP and \fIzsh\fP, the arrays used by
  117. X! \fIksh\fP, \fIrc\fP, \fIawk\fP, \fIperl\fP, \fItcl\fP, and the positional
  118. X! parameters used by all shells (if overwritten by \fBparseargs\fP) will
  119. X! preserve any \s-1IFS\s+1 characters in their contents.  That is to say that
  120. X! if an item in one of the aforementioned multi-word lists contains any
  121. X! \s-1IFS\s+1 characters, it will not be split up into multiple items but
  122. X! will remain a single item which contains \s-1IFS\s+1 characters.
  123. X*** parseargs.c.OLD    Thu May 21 11:07:24 1992
  124. X--- parseargs.c    Mon May 18 12:03:13 1992
  125. X***************
  126. X*** 1700,1709 ****
  127. X  **    for setting up an argument list depends largely upon the syntax of
  128. X  **    shell that was specified on the command line via the -s option
  129. X  **    (although ARGLIST arguments are treated exactly the same as ARGVEC
  130. X! **    arguments).  With the exception perl which always uses a comma to
  131. X! **    separate array elements, all shells will use the string specified
  132. X! **    with the -S option as the field separator between elements of an
  133. X! **    array (the default field separator is a space character).
  134. X  **
  135. X  ** ^Resetting_the_Positional_Parameters_to_an_Argument_List:
  136. X  **    For the Bourne, Bourne-Again, and Korn shells, if the variable name
  137. X--- 1700,1709 ----
  138. X  **    for setting up an argument list depends largely upon the syntax of
  139. X  **    shell that was specified on the command line via the -s option
  140. X  **    (although ARGLIST arguments are treated exactly the same as ARGVEC
  141. X! **    arguments). With the exception of perl which always uses a comma to
  142. X! **    separate array elements, all shells will use the string specified with
  143. X! **    the -S option as the field separator between elements of an array (the
  144. X! **    default field separator is a space character).
  145. X  **
  146. X  ** ^Resetting_the_Positional_Parameters_to_an_Argument_List:
  147. X  **    For the Bourne, Bourne-Again, and Korn shells, if the variable name
  148. X***************
  149. X*** 1722,1729 ****
  150. X  **    to the contents of the argument list.
  151. X  **
  152. X  **    For the Plan 9 shell (rc), if the variable name corresponding to the
  153. X! **    ARGLIST argument is "*", then the positional parameters of then calling
  154. X! **    program will be re-assigned to the contents of the argument list.
  155. X  **
  156. X  **    For awk and perl, if the variable name corresponding to the ARGLIST
  157. X  **    argument is "ARGV", then the positional parameters of the calling
  158. X--- 1722,1730 ----
  159. X  **    to the contents of the argument list.
  160. X  **
  161. X  **    For the Plan 9 shell (rc), if the variable name corresponding to the
  162. X! **    ARGLIST argument is "*", then the positional parameters of the
  163. X! **    calling program will be re-assigned to the contents of the argument
  164. X! **    list.
  165. X  **
  166. X  **    For awk and perl, if the variable name corresponding to the ARGLIST
  167. X  **    argument is "ARGV", then the positional parameters of the calling
  168. X***************
  169. X*** 1843,1856 ****
  170. X  **
  171. X  **         @name=( 'arg1' , 'arg2' ,  ... );
  172. X  **
  173. X  ** ^A_Final_Note_on_Argument_Lists:
  174. X! **    The word-lists used by the C and Z shells, the arrays used by the Korn
  175. X! **    shell, the Plan 9 shell, awk, perl, and the positional parameters used
  176. X! **    by all shells (if overwritten by parseargs) will preserve any IFS
  177. X! **    characters in their contents.  That is to say that if an item in one
  178. X! **    of the aforementioned multi-word lists contains any IFS characters, it
  179. X! **    will not be split up into multiple items but will remain a single item
  180. X! **    which contains IFS characters.
  181. X  **
  182. X  ** ^REQUIREMENTS:
  183. X  **    <val> should correspond to the vlue of the argument indicated by <ad>
  184. X--- 1844,1872 ----
  185. X  **
  186. X  **         @name=( 'arg1' , 'arg2' ,  ... );
  187. X  **
  188. X+ ** ^Tcl_Argument_Lists:
  189. X+ **    For tcl, each argument list is considered a list and is set using the
  190. X+ **    following syntax:
  191. X+ **
  192. X+ **         set name [ list 'arg1'  'arg2'   ... ] ;
  193. X+ **
  194. X  ** ^A_Final_Note_on_Argument_Lists:
  195. X! **    The word-lists used by the csh and zsh, the arrays used by ksh, rc,
  196. X! **    awk, perl, tcl, and the positional parameters used by all shells (if
  197. X! **    overwritten by parseargs) will preserve any IFS characters in their
  198. X! **    contents.  That is to say that if an item in one of the aforementioned
  199. X! **    multi-word lists contains any IFS characters, it will not be split up
  200. X! **    into multiple items but will remain a single item which contains IFS
  201. X! **    characters.
  202. X! **
  203. X! **    Parseargs treats ARGLIST arguments in a special way. The method used
  204. X! **    for setting up an argument list depends largely upon the syntax of
  205. X! **    shell that was specified on the command line via the -s option
  206. X! **    (although ARGLIST arguments are treated exactly the same as ARGVEC
  207. X! **    arguments).  With the exception perl which always uses a comma to
  208. X! **    separate array elements, all shells will use the string specified
  209. X! **    with the -S option as the field separator between elements of an
  210. X! **    array (the default field separator is a space character).
  211. X  **
  212. X  ** ^REQUIREMENTS:
  213. X  **    <val> should correspond to the vlue of the argument indicated by <ad>
  214. X*** patchlevel.h.OLD    Thu May 21 11:07:39 1992
  215. X--- patchlevel.h    Thu May 21 11:06:03 1992
  216. X***************
  217. X*** 3,8 ****
  218. X--- 3,14 ----
  219. X  **
  220. X  ** ^HISTORY:
  221. X  **
  222. X+ **    05/18/92    Brad Appleton    <brad@ssd.csd.harris.com>
  223. X+ **    Patch12
  224. X+ **    - Fixes to the Makefile and for tcl.
  225. X+ **    - Added tcl to the documentation
  226. X+ **    - Fixed error in strfuncs.h for strndup prototypes.
  227. X+ **
  228. X  **    01/02/92    Brad Appleton    <brad@ssd.csd.harris.com>
  229. X  **    Patch11
  230. X  **    - Added strndup() to strfuncs.[ch]
  231. X***************
  232. X*** 155,161 ****
  233. X  
  234. X  #define  VERSION     2
  235. X  #define  REVISION    0
  236. X! #define  PATCHLEVEL  11
  237. X  
  238. X  #ifdef __STDC__
  239. X     static const char
  240. X--- 161,167 ----
  241. X  
  242. X  #define  VERSION     2
  243. X  #define  REVISION    0
  244. X! #define  PATCHLEVEL  12
  245. X  
  246. X  #ifdef __STDC__
  247. X     static const char
  248. X***************
  249. X*** 162,165 ****
  250. X  #else
  251. X     static char
  252. X  #endif
  253. X!    _Ident[] = "@(#)parseargs  2.0  patchlevel 11";
  254. X--- 168,171 ----
  255. X  #else
  256. X     static char
  257. X  #endif
  258. X!    _Ident[] = "@(#)parseargs  2.0  patchlevel 12";
  259. X*** strfuncs.h.OLD    Thu May 21 11:07:49 1992
  260. X--- strfuncs.h    Mon May 18 14:29:59 1992
  261. X***************
  262. X*** 23,30 ****
  263. X  EXTERN  char  *strlwr       ARGS(( char * ));
  264. X  EXTERN  int    stricmp      ARGS(( const char *, const char * ));
  265. X  EXTERN  int    strnicmp     ARGS(( const char *, const char *, size_t ));
  266. X! EXTERN  char  *strndup      ARGS(( const char * ));
  267. X! EXTERN  char  *strndup      ARGS(( const char * ));
  268. X  EXTERN  char  *strdup       ARGS(( const char * ));
  269. X  
  270. X  #ifdef BSD
  271. X--- 23,30 ----
  272. X  EXTERN  char  *strlwr       ARGS(( char * ));
  273. X  EXTERN  int    stricmp      ARGS(( const char *, const char * ));
  274. X  EXTERN  int    strnicmp     ARGS(( const char *, const char *, size_t ));
  275. X! EXTERN  char  *strdup       ARGS(( const char * ));
  276. X! EXTERN  char  *strndup      ARGS(( const char *, unsigned len ));
  277. X  EXTERN  char  *strdup       ARGS(( const char * ));
  278. X  
  279. X  #ifdef BSD
  280. X*** test.tcl.OLD    Thu May 21 11:07:59 1992
  281. X--- test.tcl    Mon May 18 14:45:39 1992
  282. X***************
  283. X*** 31,46 ****
  284. X  eval [ parseargs -u -a $arguments $scriptName $argv ]
  285. X  
  286. X  ## print  the parsed arguments (use defaults if not defined)
  287. X! puts stdout "ARGUMENTS:"
  288. X! puts stdout "=========="
  289. X! puts stdout "Groups = $groups"
  290. X! puts stdout "Count = $count"
  291. X! puts stdout "Directory = $dirname"
  292. X! puts stdout "XFlag = $xflag"
  293. X! puts stdout "YFlag = $yflag"
  294. X! puts stdout "SepChar = $sepch"
  295. X! puts stdout "Name = $name"
  296. X! puts stdout "Files = $files"
  297. X  if {( "$string_flag" != "") } {
  298. X    if {( "$string" == "" )} {
  299. X      set string "!string arg ommitted on cmd-line!"
  300. X--- 31,46 ----
  301. X  eval [ parseargs -u -a $arguments $scriptName $argv ]
  302. X  
  303. X  ## print  the parsed arguments (use defaults if not defined)
  304. X! echo "ARGUMENTS:"
  305. X! echo "=========="
  306. X! echo "Groups = $groups"
  307. X! echo "Count = $count"
  308. X! echo "Directory = $dirname"
  309. X! echo "XFlag = $xflag"
  310. X! echo "YFlag = $yflag"
  311. X! echo "SepChar = $sepch"
  312. X! echo "Name = $name"
  313. X! echo "Files = $files"
  314. X  if {( "$string_flag" != "") } {
  315. X    if {( "$string" == "" )} {
  316. X      set string "!string arg ommitted on cmd-line!"
  317. X***************
  318. X*** 48,53 ****
  319. X  } else {
  320. X    set string "default string"
  321. X  }
  322. X! puts stdout "String = $string"
  323. X! puts stdout "argv = $argv"
  324. X  
  325. X--- 48,53 ----
  326. X  } else {
  327. X    set string "default string"
  328. X  }
  329. X! echo "String = $string"
  330. X! echo "argv = $argv"
  331. X  
  332. END_OF_FILE
  333. if test 10305 -ne `wc -c <'PATCH12'`; then
  334.     echo shar: \"'PATCH12'\" unpacked with wrong size!
  335. fi
  336. # end of 'PATCH12'
  337. fi
  338. echo shar: End of shell archive.
  339. exit 0
  340.  
  341. exit 0 # Just in case...
  342.