home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume26 / kit / pch22 < prev    next >
Encoding:
Text File  |  1993-05-04  |  22.9 KB  |  854 lines

  1. Newsgroups: comp.sources.unix
  2. From: ram@acri.fr (Raphael Manfredi)
  3. Subject: v26i232: kit - the ultimate mailing kit, Patch22
  4. Sender: unix-sources-moderator@efficacy.home.vix.com
  5. Approved: WhoAmI@efficacy.home.vix.com
  6.  
  7. Submitted-By: ram@acri.fr (Raphael Manfredi)
  8. Posting-Number: Volume 26, Issue 232
  9. Archive-Name: kit/pch22
  10.  
  11. [The latest patch for kit version 2.0 is #28.]
  12.  
  13. System: kit version 2.0
  14. Patch #: 22
  15. Priority: VERY LOW
  16. Subject: new getopt target
  17. Subject: created
  18. Subject: now uses external getopt script for option parsing
  19. Subject: fixed some typos in the help message
  20. Subject: manual page now carries version number and patchlevel
  21. Subject: added OPTIONS section for quick reference
  22. Subject: sorting done numerically with -n option
  23. Subject: new getopt.SH script
  24. Date: Mon Jan 11 18:09:41 PST 1993
  25. From: Raphael Manfredi <ram@eiffel.com>
  26.  
  27. Description:
  28.     Created getopt script in order to avoid code duplication for
  29.     option parsing.
  30.  
  31.     Fixed some typos in the help message of unkit.
  32.  
  33.     The manual page now carries version number and patchlevel and
  34.     has a new OPTIONS section for quick reference (requested by
  35.     Christian Bertin <bertin@acri.fr>).
  36.  
  37.     New getopt.SH script
  38.  
  39. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your kit source
  40.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  41.     If you don't have the patch program, apply the following by hand,
  42.     or get patch (version 2.0, latest patchlevel).
  43.  
  44.     After patching:
  45.         Configure -d
  46.         make
  47.         make install
  48.  
  49.     If patch indicates that patchlevel is the wrong version, you may need
  50.     to apply one or more previous patches, or the patch may already
  51.     have been applied.  See the patchlevel.h file to find out what has or
  52.     has not been applied.  In any event, don't continue with the patch.
  53.  
  54.     If you are missing previous patches they can be obtained from me:
  55.  
  56.         Raphael Manfredi <ram@eiffel.com>
  57.  
  58.     If you send a mail message of the following form it will greatly speed
  59.     processing:
  60.  
  61.         Subject: Command
  62.         @SH mailpatch PATH kit 2.0 LIST
  63.                ^ note the c
  64.  
  65.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  66.     or in bang notation from some well-known host, and LIST is the number
  67.     of one or more patches you need, separated by spaces, commas, and/or
  68.     hyphens.  Saying 35- says everything from 35 to the end.
  69.  
  70.     To get some more detailed instructions, send me the following mail:
  71.  
  72.         Subject: Command
  73.         @SH mailhelp PATH
  74.  
  75.  
  76. Index: patchlevel.h
  77. Prereq: 21
  78. 2c2
  79. < #define PATCHLEVEL 21
  80. ---
  81. > #define PATCHLEVEL 22
  82.  
  83. Index: kit/kit.SH
  84. Prereq: 2.0.1.12
  85. *** kit/kit.SH.old    Mon Jan 11 18:09:19 1993
  86. --- kit/kit.SH    Mon Jan 11 18:09:20 1993
  87. ***************
  88. *** 26,34 ****
  89.   !GROK!THIS!
  90.   $spitshell >>kit <<'!NO!SUBS!'
  91.   
  92. ! # $Id: kit.SH,v 2.0.1.12 92/11/03 10:12:34 ram Exp $
  93.   #
  94.   # $Log:    kit.SH,v $
  95.   # Revision 2.0.1.12  92/11/03  10:12:34  ram
  96.   # patch21: option parsing can now deal with embeded spaces in arguments
  97.   # 
  98. --- 26,37 ----
  99.   !GROK!THIS!
  100.   $spitshell >>kit <<'!NO!SUBS!'
  101.   
  102. ! # $Id: kit.SH,v 2.0.1.13 93/01/11 18:06:46 ram Exp $
  103.   #
  104.   # $Log:    kit.SH,v $
  105. + # Revision 2.0.1.13  93/01/11  18:06:46  ram
  106. + # patch22: now uses external getopt script for option parsing
  107. + # 
  108.   # Revision 2.0.1.12  92/11/03  10:12:34  ram
  109.   # patch21: option parsing can now deal with embeded spaces in arguments
  110.   # 
  111. ***************
  112. *** 132,184 ****
  113.   '
  114.   
  115.   # Process the command line options
  116. ! set X `for arg in "$@"; do echo $arg; done | awk '
  117. ! BEGIN {
  118. !     optstr = "BEFHMVXefhpxS:a:d:k:l:m:n:s:";    # getopt-style specification
  119. !     len = length(optstr);
  120. !     for (i = 1; i <= len; i++) {
  121. !         c = substr(optstr, i, 1);
  122. !         if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  123. !         if (a == ":") {
  124. !             arg[c] = 1;
  125. !             i++;
  126. !         }
  127. !         opt[c] = 1;
  128. !     }
  129. ! }
  130. ! {
  131. !     expect = 0;
  132. !     str = $0;
  133. !     if (substr(str, 1, 1) != "-") {
  134. !         printf("'"'%s'"'\n", str);
  135. !         next;
  136. !     }
  137. !     len = length($0);
  138. !     for (i = 2; i <= len; i++) {
  139. !         c = substr(str, i, 1);
  140. !         if (!opt[c]) {
  141. !             printf("-%s\n", substr(str, i));
  142. !             next;
  143. !         }
  144. !         printf("-%s\n", c);
  145. !         if (arg[c]) {
  146. !             if (i < len)
  147. !                 printf("'"'%s'"'\n", substr(str, i + 1));
  148. !             else
  149. !                 expect = 1;
  150. !             next;
  151. !         }
  152. !     }
  153. ! }
  154. ! END {
  155. !     if (expect)
  156. !         print "?";
  157. ! }
  158. ! '`
  159. ! eval "set $*"
  160. ! shift
  161.   while test $# -gt 0
  162.   do
  163.       case "$1" in 
  164. --- 135,141 ----
  165.   '
  166.   
  167.   # Process the command line options
  168. ! eval "set X "`$libdir/getopt BEFHMVXefhpxS:a:d:k:l:m:n:s: "$@"`; shift
  169.   while test $# -gt 0
  170.   do
  171.       case "$1" in 
  172.  
  173. Index: man/kit.SH
  174. Prereq: 2.0.1.10
  175. *** man/kit.SH.old    Mon Jan 11 18:09:32 1993
  176. --- man/kit.SH    Mon Jan 11 18:09:34 1993
  177. ***************
  178. *** 15,26 ****
  179.   echo "Extracting man/kit.$manext (with variable substitutions)"
  180.   $rm -f kit.$manext
  181.   $spitshell >kit.$manext <<!GROK!THIS!
  182. ! .TH KIT $manext ram
  183.   ''' @(#) Manual page for mailing kit -- (c) ram July 1990
  184.   '''
  185. ! ''' $Id: kit.SH,v 2.0.1.10 92/08/17 18:01:16 ram Exp $
  186.   '''
  187.   ''' $Log:    kit.SH,v $
  188.   ''' Revision 2.0.1.10  92/08/17  18:01:16  ram
  189.   ''' patch18: documents new -k option for unkit
  190.   ''' patch18: unkit can now deal with multiple kit parts in a single file
  191. --- 15,30 ----
  192.   echo "Extracting man/kit.$manext (with variable substitutions)"
  193.   $rm -f kit.$manext
  194.   $spitshell >kit.$manext <<!GROK!THIS!
  195. ! .TH KIT $manext "Version $VERSION PL$PATCHLEVEL"
  196.   ''' @(#) Manual page for mailing kit -- (c) ram July 1990
  197.   '''
  198. ! ''' $Id: kit.SH,v 2.0.1.11 93/01/11 18:08:33 ram Exp $
  199.   '''
  200.   ''' $Log:    kit.SH,v $
  201. + ''' Revision 2.0.1.11  93/01/11  18:08:33  ram
  202. + ''' patch22: manual page now carries version number and patchlevel
  203. + ''' patch22: added OPTIONS section for quick reference
  204. + ''' 
  205.   ''' Revision 2.0.1.10  92/08/17  18:01:16  ram
  206.   ''' patch18: documents new -k option for unkit
  207.   ''' patch18: unkit can now deal with multiple kit parts in a single file
  208. ***************
  209. *** 83,88 ****
  210. --- 87,95 ----
  211.   .sp
  212.   \fBunkit\fR [ \fB\-bhlprV\fR ] [ \fB\-k\fI key\fR ] [ \fIfiles\fR ]
  213.   .SH DESCRIPTION
  214. + '''
  215. + ''' Kit
  216. + '''
  217.   \fIKit\fR is the ultimate mailing tool. It enables you to mail
  218.   data without any consideration of possible escape sequences or
  219.   control characters.
  220. ***************
  221. *** 146,151 ****
  222. --- 153,161 ----
  223.   argument. It can be given in bytes (e.g. \fI\-S 40000\fR to set the maximum
  224.   part size to 40000 bytes) or in kbytes by appending a \fIk\fR at the end
  225.   (i.e. \fI-S 60k\fR would produce parts with size ranging up to 61440 bytes).
  226. + '''
  227. + ''' Mailkit
  228. + '''
  229.   .PP
  230.   \fIMailkit\fR takes "Kit*" files and sends them to a list of addresses.
  231.   The \fB\-n\fR option can be used to change that base name, if necessary.
  232. ***************
  233. *** 199,204 ****
  234. --- 209,217 ----
  235.   1, 4 trough 7 and 10. Finally, \fI-5,8-\fR would send parts 1 through 5 and
  236.   8 up to the end. If you introduce spaces in your range list specification,
  237.   do not forget to quote the whole list for the shell...
  238. + '''
  239. + ''' Unkit
  240. + '''
  241.   .PP
  242.   \fIUnkit\fR is used to restore the original files. The argument is
  243.   a list of archive files (or mail files, as \fIunshar\fR(1), which
  244. ***************
  245. *** 234,239 ****
  246. --- 247,415 ----
  247.   For all of these commands, option \fB\-V\fR prints the version
  248.   number with the current patch level and exits, while \fB\-h\fR gives
  249.   a little help message with the syntax and the meaning of the options.
  250. + .SH OPTIONS
  251. + This section summarizes the different options. All the options may be specified
  252. + separately (e.g. \fB\-a \-b \fIfoo\fR \-c) or grouped together, along with
  253. + optional arguments (e.g. \fB\-ac\fR \fB\-b\fIfoo\fR). Option parsing stops
  254. + when \-\- is encountered.
  255. + '''
  256. + ''' Kit
  257. + '''
  258. + .PP
  259. + \fIKit\fR has the following options:
  260. + .TP 15
  261. + .B \-B
  262. + Use \fIbtoa\fR encoding (default), as opposed to hexadecimal encoding.
  263. + .TP
  264. + .B \-E
  265. + Edit instructions which will be sent as part #0.
  266. + .TP
  267. + .B \-F
  268. + Get instructions to be sent as part #0 from standard input.
  269. + .TP
  270. + .B \-H
  271. + Use hexadecimal encoding, as opposed to the default \fIbtoa\fR. This is an
  272. + obsolete feature, kept for compatibility with \fIkit\fR 1.0.
  273. + .TP
  274. + .B \-M
  275. + Include \fIminikit\fR in the distribution, in order to allow unkiting
  276. + by the recipient, should \fIkit\fR be missing at the remote site. Note that
  277. + \fIminikit\fR will only be able to unkit plain \fIbtoa\fR-encoded packages
  278. + (i.e. encryption is not supported, although automatic acknowledgment is).
  279. + .TP
  280. + .B \-V
  281. + Print version number and patchlevel.
  282. + .TP
  283. + .B \-S\fI size
  284. + Set each part size in bytes or kbytes (by appending a single \fIk\fR after
  285. + the size figure). The actual size of each part may be slightly bigger than
  286. + the maximum stated (a few hundred bytes at most).
  287. + .TP
  288. + .B \-X
  289. + Encryption with DES Electronic Code Block algorithm.
  290. + You will be prompted for a key, unless you specify one on the command line via
  291. + the \fB\-k\fR option.
  292. + .TP
  293. + .B \-a\fI address
  294. + Ask the unkiting process to send an acknowldgment to the specified e-mail
  295. + address upon successful extraction.
  296. + .TP
  297. + .B \-d\fI dir
  298. + Put temporary files in the specified directory. This is useful if you do not
  299. + have writing permission in the current directory. If you specify a common
  300. + directory like \fI/tmp\fR, be sure to use the \fB\-n\fR option or your kit
  301. + might be clobbered if somebody else is doing the same thing.
  302. + .TP
  303. + .B \-e
  304. + Edit instructions to be sent at the top of each part.
  305. + .TP
  306. + .B \-f
  307. + Get instructions to be sent at the top of each part from standard input.
  308. + .TP
  309. + .B \-h
  310. + Print usage and option summary.
  311. + .TP
  312. + .B \-k\fI key
  313. + Set the key to be used for encryption. The \fB\-x\fR option will be assumed,
  314. + unless \fB\-X\fR is explicitely given to override the default.
  315. + .TP
  316. + .B \-m\fI address
  317. + Invoke \fImailkit\fR to send all the parts at the given address. Several
  318. + \fB\-m\fR may be specifed to send the package to more than one recipient. The
  319. + kit parts will be removed at the end, unless \fB\-p\fR is given. When sending
  320. + large files to multiple recipients, it is wise to use this option in case one
  321. + part gets lost.
  322. + .TP
  323. + .B \-l\fI file
  324. + Send the kit parts to the recipients held in the file (one recipient per line).
  325. + .TP
  326. + .B \-n\fI basename
  327. + Set the basename of the generated parts. The default is \fIKit\fR. You should
  328. + use this option when a kit is already present in the current directory, or when
  329. + you use something like \fB\-d /tmp\fR.
  330. + .TP
  331. + .B \-p
  332. + Preserve file sent. This option is meaningful only when \fB\-m\fR or \fB-l\fR
  333. + is given.
  334. + .TP
  335. + .B \-s\fI name
  336. + Set the kit name, which will be copied as-is into the Subject of messages
  337. + sent by \fImailkit\fR (provided \fB\-m\fR or \fB\-l\fR is specified), and also
  338. + in the automatic acknowledgment. By default, the name of the first directory
  339. + or file specified on the command line will be used.
  340. + .TP
  341. + .B \-x
  342. + Use DES Cipher Block Chaining encryption algorithm.
  343. + You will be prompted for a key, unless you specify one on the command line via
  344. + the \fB\-k\fR option.
  345. + '''
  346. + ''' Mailkit
  347. + '''
  348. + .PP
  349. + \fIMailkit\fR recognizes the following options:
  350. + .TP 15
  351. + .B \-E
  352. + Edit instructions which will be sent as part #0.
  353. + .TP
  354. + .B \-F
  355. + Get instructions to be sent as part #0 from standard input.
  356. + .TP
  357. + .B \-V
  358. + Print version number and patchlevel.
  359. + .TP
  360. + .B \-c
  361. + Clean up after each part sent: all the parts successfully sent will be
  362. + removed from the disk.
  363. + .TP
  364. + .B \-e
  365. + Edit instructions to be sent at the top of each part.
  366. + .TP
  367. + .B \-f
  368. + Get instructions to be sent at the top of each part from standard input.
  369. + .TP
  370. + .B \-h
  371. + Print usage and option summary.
  372. + .TP
  373. + .B \-l\fI file
  374. + Get the recipient list from a file (one recipient per line).
  375. + .TP
  376. + .B \-n\fI basename
  377. + Set the basename of the generated parts. The default is \fIKit\fR. You should
  378. + use this option when more than one kit is present in the current directory,
  379. + or when you used the \fIkit\fR's \fB\-n\fR option to change the default
  380. + basename.
  381. + .TP
  382. + .B \-p
  383. + Preserve files sent. This is the default, unless \fB\-c\fR is specified.
  384. + .TP
  385. + .B \-r\fI range
  386. + Specify which parts are to be sent. For instance, \fB\-r\fI 1,4-7\fR would
  387. + send part #1 and then parts #4 through #7.
  388. + '''
  389. + ''' Unkit
  390. + '''
  391. + .PP
  392. + \fIUnkit\fR uses the following options:
  393. + .TP 15
  394. + .B \-V
  395. + Print version number and patchlevel.
  396. + .TP
  397. + .B \-b
  398. + Force usage of \fIbadtar\fR.
  399. + .TP
  400. + .B \-h
  401. + Print usage and option summary.
  402. + .TP
  403. + .B \-k\fI key
  404. + Set the key to be used for data decryption. \fIUnkit\fR is able to determine
  405. + automatically whether decryption is needed or not and will prompt you for the
  406. + key unless this option is used.
  407. + .TP
  408. + .B \-l
  409. + Lists the files contained in the kit package without extracting them.
  410. + .TP
  411. + .B \-r
  412. + Remove input files if unshar succeeds.
  413.   .SH FILES
  414.   .PD 0
  415.   .TP 15
  416.  
  417. Index: kit/unkit.SH
  418. Prereq: 2.0.1.14
  419. *** kit/unkit.SH.old    Mon Jan 11 18:09:28 1993
  420. --- kit/unkit.SH    Mon Jan 11 18:09:29 1993
  421. ***************
  422. *** 19,27 ****
  423.   # @(#) (c) E. Mogenet April 1990
  424.   # @(#) (c) R. Manfredi, 1990 1991
  425.   
  426. ! # $Id: unkit.SH,v 2.0.1.14 92/11/03 10:12:44 ram Exp $
  427.   #
  428.   # $Log:    unkit.SH,v $
  429.   # Revision 2.0.1.14  92/11/03  10:12:44  ram
  430.   # patch21: option parsing can now deal with embeded spaces in arguments
  431.   # 
  432. --- 19,31 ----
  433.   # @(#) (c) E. Mogenet April 1990
  434.   # @(#) (c) R. Manfredi, 1990 1991
  435.   
  436. ! # $Id: unkit.SH,v 2.0.1.15 93/01/11 18:07:29 ram Exp $
  437.   #
  438.   # $Log:    unkit.SH,v $
  439. + # Revision 2.0.1.15  93/01/11  18:07:29  ram
  440. + # patch22: now uses external getopt script for option parsing
  441. + # patch22: fixed some typos in the help message
  442. + # 
  443.   # Revision 2.0.1.14  92/11/03  10:12:44  ram
  444.   # patch21: option parsing can now deal with embeded spaces in arguments
  445.   # 
  446. ***************
  447. *** 85,90 ****
  448. --- 89,95 ----
  449.   # Which patch-level is it ?
  450.   pl='$PATCHLEVEL'
  451.   version='$VERSION'
  452. + libdir='$privlib'
  453.   
  454.   # Tar options to be used
  455.   badtar='$needbtar'
  456. ***************
  457. *** 126,133 ****
  458.   echo "Usage: unkit [-bhlprV] [-k key] [file1 ... filen]";
  459.   echo " "" -b : force use of badtar ($badtar by default).";
  460.   echo " "" -h : give this help message.";
  461. ! echo " "" -k : sets the key used for data decryption.";
  462. ! echo " "" -l : list the contents of a the kit files.";
  463.   echo " "" -p : preserve input files (default).";
  464.   echo " "" -r : remove input files if unshar succeeds.";
  465.   echo " "" -V : print current version and patch-level.";
  466. --- 131,138 ----
  467.   echo "Usage: unkit [-bhlprV] [-k key] [file1 ... filen]";
  468.   echo " "" -b : force use of badtar ($badtar by default).";
  469.   echo " "" -h : give this help message.";
  470. ! echo " "" -k : set the key used for data decryption.";
  471. ! echo " "" -l : list files held in the kit parts.";
  472.   echo " "" -p : preserve input files (default).";
  473.   echo " "" -r : remove input files if unshar succeeds.";
  474.   echo " "" -V : print current version and patch-level.";
  475. ***************
  476. *** 135,188 ****
  477.   '
  478.   
  479.   # Process the command line options
  480. ! set X `for arg in "$@"; do echo $arg; done | awk '
  481. ! BEGIN {
  482. !     optstr = "bhlprVk:";    # getopt-style specification
  483. !     len = length(optstr);
  484. !     for (i = 1; i <= len; i++) {
  485. !         c = substr(optstr, i, 1);
  486. !         if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  487. !         if (a == ":") {
  488. !             arg[c] = 1;
  489. !             i++;
  490. !         }
  491. !         opt[c] = 1;
  492. !     }
  493. ! }
  494. ! {
  495. !     expect = 0;
  496. !     str = $0;
  497. !     if (substr(str, 1, 1) != "-") {
  498. !         printf("'"'%s'"'\n", str);
  499. !         next;
  500. !     }
  501. !     len = length($0);
  502. !     for (i = 2; i <= len; i++) {
  503. !         c = substr(str, i, 1);
  504. !         if (!opt[c]) {
  505. !             printf("-%s\n", substr(str, i));
  506. !             next;
  507. !         }
  508. !         printf("-%s\n", c);
  509. !         if (arg[c]) {
  510. !             if (i < len)
  511. !                 printf("'"'%s'"'\n", substr(str, i + 1));
  512. !             else
  513. !                 expect = 1;
  514. !             next;
  515. !         }
  516. !     }
  517. ! }
  518. ! END {
  519. !     if (expect)
  520. !         print "?";
  521. ! }
  522. ! '`
  523. ! eval "set $*"
  524. ! shift
  525. ! # Option parsing
  526.   while test $# -gt 0
  527.   do
  528.       case "$1" in
  529. --- 140,146 ----
  530.   '
  531.   
  532.   # Process the command line options
  533. ! eval "set X "`$libdir/getopt bhlprVk: "$@"`; shift
  534.   while test $# -gt 0
  535.   do
  536.       case "$1" in
  537.  
  538. Index: kit/getopt.SH
  539. *** kit/getopt.SH.old    Mon Jan 11 18:09:15 1993
  540. --- kit/getopt.SH    Mon Jan 11 18:09:15 1993
  541. ***************
  542. *** 0 ****
  543. --- 1,93 ----
  544. + case $CONFIG in
  545. + '')
  546. +     if test ! -f config.sh; then
  547. +         ln ../config.sh . || \
  548. +         ln ../../config.sh . || \
  549. +         ln ../../../config.sh . || \
  550. +         ln ../../../../config.sh . || \
  551. +         (echo "Can't find config.sh."; exit 1)
  552. +     fi 2>/dev/null
  553. +     . ./config.sh
  554. +     ;;
  555. + esac
  556. + case "$0" in
  557. + */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  558. + esac
  559. + echo "Extracting kit/getopt (with variable substitutions)"
  560. + $spitshell >getopt <<!GROK!THIS!
  561. + $startsh
  562. + !GROK!THIS!
  563. + $spitshell >>getopt <<'!NO!SUBS!'
  564. + # Usage: getopt optstr [options]
  565. + #
  566. + # Here is a typical use inside a script:
  567. + #    eval "set X "`getopt optstr "$@"`
  568. + #    shift
  569. + #
  570. + # Then the $* array can then be parsed as usual, with all the options up to
  571. + # any optional '--' split up, for instance '-lfoo' becomes '-l foo' if l: is
  572. + # given in optstr, and '-lf' becomes '-l -f' if only lf is given as optstr.
  573. + # $Id: getopt.SH,v 2.0.1.1 93/01/11 18:04:27 ram Exp $
  574. + #
  575. + # $Log:    getopt.SH,v $
  576. + # Revision 2.0.1.1  93/01/11  18:04:27  ram
  577. + # patch22: created
  578. + # 
  579. + # Options specification (getopt style)
  580. + optstr=$1; shift
  581. + # Process the command line options
  582. + set X `for arg in "$@"; do echo $arg; done | awk '
  583. + BEGIN {
  584. +     optstr = "'$optstr'";    # getopt-style specification
  585. +     len = length(optstr);
  586. +     for (i = 1; i <= len; i++) {
  587. +         c = substr(optstr, i, 1);
  588. +         if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  589. +         if (a == ":") {
  590. +             arg[c] = 1;
  591. +             i++;
  592. +         }
  593. +         opt[c] = 1;
  594. +     }
  595. + }
  596. + {
  597. +     expect = 0;
  598. +     str = $0;
  599. +     if (str == "--")
  600. +         ended = 1;
  601. +     if (ended || substr(str, 1, 1) != "-") {
  602. +         printf("'"'%s'"'\n", str);
  603. +         next;
  604. +     }
  605. +     len = length($0);
  606. +     for (i = 2; i <= len; i++) {
  607. +         c = substr(str, i, 1);
  608. +         if (!opt[c]) {
  609. +             printf("-%s\n", substr(str, i));
  610. +             next;
  611. +         }
  612. +         printf("-%s\n", c);
  613. +         if (arg[c]) {
  614. +             if (i < len)
  615. +                 printf("'"'%s'"'\n", substr(str, i + 1));
  616. +             else
  617. +                 expect = 1;
  618. +             next;
  619. +         }
  620. +     }
  621. + }
  622. + END {
  623. +     if (expect)
  624. +         print "?";
  625. + }
  626. + '`
  627. + shift
  628. + echo $@
  629. + !NO!SUBS!
  630. + chmod 755 getopt
  631. + $eunicefix getopt
  632.  
  633. Index: kit/mailkit.SH
  634. Prereq: 2.0.1.11
  635. *** kit/mailkit.SH.old    Mon Jan 11 18:09:23 1993
  636. --- kit/mailkit.SH    Mon Jan 11 18:09:24 1993
  637. ***************
  638. *** 18,26 ****
  639.   # @(#) Mailer for kit files
  640.   # @(#) (c) R. Manfredi, 1990 1991
  641.   
  642. ! # $Id: mailkit.SH,v 2.0.1.11 92/11/03 10:12:40 ram Exp $
  643.   #
  644.   # $Log:    mailkit.SH,v $
  645.   # Revision 2.0.1.11  92/11/03  10:12:40  ram
  646.   # patch21: option parsing can now deal with embeded spaces in arguments
  647.   # 
  648. --- 18,29 ----
  649.   # @(#) Mailer for kit files
  650.   # @(#) (c) R. Manfredi, 1990 1991
  651.   
  652. ! # $Id: mailkit.SH,v 2.0.1.12 93/01/11 18:06:55 ram Exp $
  653.   #
  654.   # $Log:    mailkit.SH,v $
  655. + # Revision 2.0.1.12  93/01/11  18:06:55  ram
  656. + # patch22: now uses external getopt script for option parsing
  657. + # 
  658.   # Revision 2.0.1.11  92/11/03  10:12:40  ram
  659.   # patch21: option parsing can now deal with embeded spaces in arguments
  660.   # 
  661. ***************
  662. *** 127,180 ****
  663.   '
  664.   
  665.   # Process the command line options
  666. ! set X `for arg in "$@"; do echo $arg; done | awk '
  667. ! BEGIN {
  668. !     optstr = "EFVcefhpn:l:r:";    # getopt-style specification
  669. !     len = length(optstr);
  670. !     for (i = 1; i <= len; i++) {
  671. !         c = substr(optstr, i, 1);
  672. !         if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  673. !         if (a == ":") {
  674. !             arg[c] = 1;
  675. !             i++;
  676. !         }
  677. !         opt[c] = 1;
  678. !     }
  679. ! }
  680. ! {
  681. !     expect = 0;
  682. !     str = $0;
  683. !     if (substr(str, 1, 1) != "-") {
  684. !         printf("'"'%s'"'\n", str);
  685. !         next;
  686. !     }
  687. !     len = length($0);
  688. !     for (i = 2; i <= len; i++) {
  689. !         c = substr(str, i, 1);
  690. !         if (!opt[c]) {
  691. !             printf("-%s\n", substr(str, i));
  692. !             next;
  693. !         }
  694. !         printf("-%s\n", c);
  695. !         if (arg[c]) {
  696. !             if (i < len)
  697. !                 printf("'"'%s'"'\n", substr(str, i + 1));
  698. !             else
  699. !                 expect = 1;
  700. !             next;
  701. !         }
  702. !     }
  703. ! }
  704. ! END {
  705. !     if (expect)
  706. !         print "?";
  707. ! }
  708. ! '`
  709. ! eval "set $*"
  710. ! shift
  711. ! # Argument parsing
  712.   while test $# -gt 0
  713.   do
  714.       case "$1" in
  715. --- 130,136 ----
  716.   '
  717.   
  718.   # Process the command line options
  719. ! eval "set X "`$libdir/getopt EFVcefhpn:l:r: "$@"`; shift
  720.   while test $# -gt 0
  721.   do
  722.       case "$1" in
  723.  
  724. Index: shar/makeshar.SH
  725. Prereq: 2.0.1.4
  726. *** shar/makeshar.SH.old    Mon Jan 11 18:09:36 1993
  727. --- shar/makeshar.SH    Mon Jan 11 18:09:36 1993
  728. ***************
  729. *** 17,25 ****
  730.   $startsh
  731.   # (c) Raphael Manfredi, December 25th 1991
  732.   
  733. ! # $Id: makeshar.SH,v 2.0.1.4 92/05/02 14:19:45 ram Exp $
  734.   #
  735.   # $Log:    makeshar.SH,v $
  736.   # Revision 2.0.1.4  92/05/02  14:19:45  ram
  737.   # patch16: maximum part size can now be specified via -s
  738.   # 
  739. --- 17,28 ----
  740.   $startsh
  741.   # (c) Raphael Manfredi, December 25th 1991
  742.   
  743. ! # $Id: makeshar.SH,v 2.0.1.5 93/01/11 18:08:54 ram Exp $
  744.   #
  745.   # $Log:    makeshar.SH,v $
  746. + # Revision 2.0.1.5  93/01/11  18:08:54  ram
  747. + # patch22: sorting done numerically with -n option
  748. + # 
  749.   # Revision 2.0.1.4  92/05/02  14:19:45  ram
  750.   # patch16: maximum part size can now be specified via -s
  751.   # 
  752. ***************
  753. *** 81,87 ****
  754.               echo "`wc -c < $i` $i"
  755.           fi
  756.       done
  757. ! ) | sort -r | awk '
  758.   # Awk is fed with a list of sizes and filenames, sorted in reverse order,
  759.   # i.e. the biggest files come first. Its output is a list of files to be
  760.   # put in the archives, each line counting for one part. The first line is
  761. --- 84,90 ----
  762.               echo "`wc -c < $i` $i"
  763.           fi
  764.       done
  765. ! ) | sort -n -r | awk '
  766.   # Awk is fed with a list of sizes and filenames, sorted in reverse order,
  767.   # i.e. the biggest files come first. Its output is a list of files to be
  768.   # put in the archives, each line counting for one part. The first line is
  769.  
  770. Index: kit/Makefile.SH
  771. Prereq: 2.0.1.6
  772. *** kit/Makefile.SH.old    Mon Jan 11 18:09:12 1993
  773. --- kit/Makefile.SH    Mon Jan 11 18:09:13 1993
  774. ***************
  775. *** 18,26 ****
  776.   # Makefile for kit (sub-directory kit)
  777.   #
  778.   
  779. ! # $Id: Makefile.SH,v 2.0.1.6 92/09/04 19:22:28 ram Exp $
  780.   #
  781.   # $Log:    Makefile.SH,v $
  782.   # Revision 2.0.1.6  92/09/04  19:22:28  ram
  783.   # patch19: forgot the 'range' target
  784.   # 
  785. --- 18,29 ----
  786.   # Makefile for kit (sub-directory kit)
  787.   #
  788.   
  789. ! # $Id: Makefile.SH,v 2.0.1.7 93/01/11 18:04:13 ram Exp $
  790.   #
  791.   # $Log:    Makefile.SH,v $
  792. + # Revision 2.0.1.7  93/01/11  18:04:13  ram
  793. + # patch22: new getopt target
  794. + # 
  795.   # Revision 2.0.1.6  92/09/04  19:22:28  ram
  796.   # patch19: forgot the 'range' target
  797.   # 
  798. ***************
  799. *** 53,59 ****
  800.   !GROK!THIS!
  801.   $spitshell >>Makefile <<'!NO!SUBS!'
  802.   bin = kit mailkit unkit
  803. ! lib = minikit range
  804.   scripts = $(bin) $(lib)
  805.   scriptsh = kit.SH mailkit.SH unkit.SH minikit.SH
  806.   added = Makefile config.sh
  807. --- 56,62 ----
  808.   !GROK!THIS!
  809.   $spitshell >>Makefile <<'!NO!SUBS!'
  810.   bin = kit mailkit unkit
  811. ! lib = minikit range getopt
  812.   scripts = $(bin) $(lib)
  813.   scriptsh = kit.SH mailkit.SH unkit.SH minikit.SH
  814.   added = Makefile config.sh
  815. ***************
  816. *** 73,78 ****
  817. --- 76,84 ----
  818.       sh $@.SH
  819.   
  820.   range: range.SH
  821. +     sh $@.SH
  822. + getopt: getopt.SH
  823.       sh $@.SH
  824.   
  825.   install: $(scripts)
  826.  
  827. Index: MANIFEST
  828. *** MANIFEST.old    Mon Jan 11 18:09:39 1993
  829. --- MANIFEST    Mon Jan 11 18:09:39 1993
  830. ***************
  831. *** 25,30 ****
  832. --- 25,31 ----
  833.   des/testdata               A set of tests to certify the des
  834.   install.SH                 BSD-like installation script
  835.   kit/Makefile.SH            Makefile for scripts
  836. + kit/getopt.SH              Option parsing library
  837.   kit/kit.SH                 The main script-shell
  838.   kit/mailkit.SH             Mails parts generated by "kit"
  839.   kit/minikit.SH             The minikit script for kit extraction
  840.  
  841. *** End of Patch 22 ***
  842.