home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / kit / pch11 < prev    next >
Encoding:
Text File  |  1992-01-11  |  43.5 KB  |  1,566 lines

  1. Newsgroups: comp.sources.unix
  2. From: ram@eiffel.com (Raphael Manfredi)
  3. Subject: v25i101: kit - the ultimate mailing kit, Patch11
  4. Sender: sources-moderator@pa.dec.com
  5. Approved: vixie@pa.dec.com
  6.  
  7. Submitted-By: ram@eiffel.com (Raphael Manfredi)
  8. Posting-Number: Volume 25, Issue 101
  9. Archive-Name: kit/pch11
  10.  
  11. [The latest patch for kit version 2.0 is #12.
  12.     ram@eiffel.com (Raphael Manfredi)
  13. ]
  14.  
  15. System: kit version 2.0
  16. Patch #: 11
  17. Priority: LOW
  18. Subject: updated Configure
  19. Subject: added subdirectories badtar and shar
  20. Subject: updated README
  21. Subject: updated config.h.SH
  22. Subject: now depends on the 'hasdes' configuration variable
  23. Subject: added declarations for static functions
  24. Subject: reported by Monty Solomon <roscom!monty@bu.edu>
  25. Subject: now uses makeshar when cshar is not installed
  26. Subject: the leading 'startsh' configuration variable was missing
  27. Subject: reported by Michael Fischer <fischer-michael@cs.yale.edu>
  28. Subject: now knows about badtar
  29. Subject: added -b option to force use of badtar
  30. Subject: the .so directive was made relative to make man happy
  31. Subject: documents badtar and cshar-emulating scripts
  32. Subject: added badtar and shar directories
  33. Date: Sat Jan 11 19:25:26 PST 1992
  34. From: Raphael Manfredi <ram@eiffel.com>
  35.  
  36. Description:
  37.  
  38.     The DES Makefile now depends on the 'hasdes' configuration
  39.     variable, which means des will not be built if a valid DES
  40.     implementation is found on the machine.
  41.  
  42.     Added declarations for static functions in des/des.c.
  43.     (reported by Monty Solomon <roscom!monty@bu.edu>)
  44.  
  45.     The main improvement... Kit is now a *standalone* package and
  46.     cshar is no longer needed to use kit, thanks to the scripts held
  47.     in the shar directory.
  48.  
  49.     The leading 'startsh' configuration variable was missing in file
  50.     kit/mailkit.SH.
  51.     (reported by Michael Fischer <fischer-michael@cs.yale.edu>)
  52.  
  53.     The release now contains the 'badtar' program which may be used
  54.     by kit to fix tar bugs and NFS idiosyncrasies.
  55.  
  56.     Added -b option to unkit to force use of badtar.
  57.  
  58.     The .so directive in man paged was made relative to make man happy.
  59.     (reported by Michael Fischer <fischer-michael@cs.yale.edu>)
  60.  
  61.  
  62. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your kit source
  63.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  64.     If you don't have the patch program, apply the following by hand,
  65.     or get patch (version 2.0, latest patchlevel).
  66.  
  67.     After patching:
  68.         *** DO NOTHING--INSTALL ALL PATCHES UP THROUGH #12 FIRST ***
  69.  
  70.     If patch indicates that patchlevel is the wrong version, you may need
  71.     to apply one or more previous patches, or the patch may already
  72.     have been applied.  See the patchlevel.h file to find out what has or
  73.     has not been applied.  In any event, don't continue with the patch.
  74.  
  75.     If you are missing previous patches they can be obtained from me:
  76.  
  77.         Raphael Manfredi <ram@eiffel.com>
  78.  
  79.     If you send a mail message of the following form it will greatly speed
  80.     processing:
  81.  
  82.         Subject: Command
  83.         @SH mailpatch PATH kit 2.0 LIST
  84.                ^ note the c
  85.  
  86.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  87.     or in bang notation from some well-known host, and LIST is the number
  88.     of one or more patches you need, separated by spaces, commas, and/or
  89.     hyphens.  Saying 35- says everything from 35 to the end.
  90.  
  91.     To get some more detailed instructions, send me the following mail:
  92.  
  93.         Subject: Command
  94.         @SH mailhelp PATH
  95.  
  96.  
  97. Index: patchlevel.h
  98. Prereq: 10
  99. 2c2
  100. < #define PATCHLEVEL 10
  101. ---
  102. > #define PATCHLEVEL 11
  103.  
  104. Index: badtar/badtar.c
  105. *** badtar/badtar.c.old    Sat Jan 11 19:24:23 1992
  106. --- badtar/badtar.c    Sat Jan 11 19:24:24 1992
  107. ***************
  108. *** 0 ****
  109. --- 1,385 ----
  110. + /*
  111. +  * I got that from net.sources and extended it -- RAM
  112. +  *
  113. +  * $Id: badtar.c,v 2.0.1.1 92/01/11 19:12:45 ram Exp $
  114. +  *
  115. +  * $Log:    badtar.c,v $
  116. +  * Revision 2.0.1.1  92/01/11  19:12:45  ram
  117. +  * patch11: created
  118. +  * 
  119. +  */
  120. + /* read tar tapes with bad blocks MWS */
  121. + #include "../config.h"
  122. + #include "../patchlevel.h"
  123. + #include <stdio.h>
  124. + #include <sys/types.h>
  125. + #include <sys/file.h>                    /* Should be metaconfigured ? */
  126. + #ifdef I_FCNTL                            /* Added by ram for O_RDONLY */
  127. + #include <fcntl.h>
  128. + #else
  129. + #include <sys/fcntl.h>
  130. + #endif
  131. + #define TBLOCK        512                    /* Size of a tape block */
  132. + #define NAMSIZ        100                    /* Maximum size for filename */
  133. + #define BLOCKF        20                    /* Blocking factor */
  134. + #define TAPEBLOCK     (BLOCKF * TBLOCK)    /* Blocksize */
  135. + int verbose = 0;                    /* Verbose output control */
  136. + int silent = 0;                        /* Silent output control */
  137. + char *default_tape = TAPEDEV;        /* Default device tape file */
  138. + /* Logging printf */
  139. + #define lprintf        if (!silent) fprintf
  140. + /* see tar (4 or 5) in the manual */
  141. + union hblock {
  142. +      char dummy[TBLOCK];
  143. +      struct header {
  144. +           char name[NAMSIZ];
  145. +           char mode[8];
  146. +           char uid[8];
  147. +           char gid[8];
  148. +           char size[12];
  149. +           char mtime[12];
  150. +           char chksum[8];
  151. +           char linkflag;
  152. +           char linkname[NAMSIZ];
  153. +      } dbuf;
  154. + };
  155. + char pad[TBLOCK];
  156. + /* Print usage */
  157. + usage()
  158. + {
  159. +     fprintf(stderr,
  160. + "Usage: badtar [-hiorsvV] [-l logfile] [-f tape drive] [-u uid] [-g gid]\n");
  161. +     fprintf(stderr, "  -V : print version number.\n");
  162. +     fprintf(stderr, "  -f : tape drive device or file (default is %s).\n",
  163. +         default_tape);
  164. +     fprintf(stderr, "  -g : set GID on extracted files (0 for current user).\n");
  165. +     fprintf(stderr, "  -h : print this help message.\n");
  166. +     fprintf(stderr, "  -i : ignore end of tape blocks.\n");
  167. +     fprintf(stderr, "  -l : define log file (default is stderr).\n");
  168. +     fprintf(stderr, "  -o : set ownership of files to current user.\n");
  169. +     fprintf(stderr, "  -r : make relative paths by removing leading '/'.\n");
  170. +     fprintf(stderr, "  -s : silent mode, no logging is done.\n");
  171. +     fprintf(stderr, "  -u : set UID on extracted files (0 for current user).\n");
  172. +     fprintf(stderr, "  -v : verbose mode, print headers found.\n");
  173. + }
  174. + /* Print version number */
  175. + version()
  176. + {
  177. +     fprintf(stderr, "badtar %.1f PL%d\n", VERSION, PATCHLEVEL);
  178. +     fprintf(stderr, "(version modified by Raphael Manfredi, as part of kit)\n");
  179. + }
  180. + /* check the check sum for the header block */
  181. + check_sum(c)
  182. + union hblock *c;
  183. + {
  184. +     int i,j;
  185. +     char *cp;
  186. +     cp = c->dummy;
  187. +     i = 0;
  188. +     for (j = 0; j < TBLOCK; j++)
  189. +         i += *cp++;
  190. +     /* When calculating the checksum, the "chksum" field is
  191. +      * treated as if it were all blanks.
  192. +      */
  193. +     for (j = 0; j < 8; j++)
  194. +         i -= c->dbuf.chksum[j];    /* Remove chksum values */
  195. +     for (j = 0; j < 8; j++)
  196. +         i += ' ';                /* Treat as blank */
  197. +     return(i);
  198. + }
  199. + char buf[TAPEBLOCK];
  200. + char xbuf[TAPEBLOCK];
  201. + int bpos = TAPEBLOCK - TBLOCK, eot = 0, bad = 0, fd1;
  202. + FILE *logf;
  203. + extern int errno;
  204. + /* get the next TBLOCK chars from the tape */
  205. + char *get_next()
  206. + {
  207. +     int res;
  208. +     int nbytes;
  209. +     if (bpos >= TAPEBLOCK - TBLOCK) {    /* Reached end of buf array */
  210. +         bcopy(xbuf, buf, TAPEBLOCK);    /* Reset buf to xbuf ('x' chars) */
  211. +         res = read(fd1, buf, TAPEBLOCK);    /* Read a new chunck */
  212. +         if (res == 0) {
  213. +             eot = 1;                    /* End of tape */
  214. +             lprintf(logf, "*** End of tape?\n");
  215. +         } else if (res < TAPEBLOCK) {
  216. +             if (res == -1) {
  217. +                 lprintf(logf, "*** Bad block on tape!!\n");
  218. +                 bad = 1; 
  219. +             } else {
  220. +                 /* We read only a partial block (maybe we are
  221. +                  * reading data through a pipe ?). Anyway, loop
  222. +                  * until TAPEBLOCK bytes have been read or an
  223. +                  * error occurred.
  224. +                  */
  225. +                 for (
  226. +                     nbytes = res;
  227. +                     nbytes < TAPEBLOCK && res != -1;
  228. +                     nbytes += res
  229. +                 ) {
  230. +                     res = read(fd1, buf + nbytes, TAPEBLOCK - nbytes);
  231. +                     if (res == -1) {
  232. +                         lprintf(logf, "*** Bad block on tape!!\n");
  233. +                         bad = 1;
  234. +                         break;
  235. +                     } else if (res == 0) {
  236. +                         eot = 1;
  237. +                         lprintf(logf, "*** End of tape?\n");
  238. +                         break;
  239. +                     }
  240. +                 }
  241. +             }
  242. +         } else if (bad) {
  243. +             lprintf(logf, "*** End of bad block(s) on tape\n");
  244. +             bad = 0;
  245. +         }
  246. +         bpos = 0;
  247. +     } else
  248. +         bpos += TBLOCK;
  249. +     fflush(logf);            /* Let they know what we're doing */
  250. +     return &buf[bpos];
  251. + }
  252. + main(argc, argv)
  253. + char **argv;
  254. + {
  255. +     int i, size, chksum, fblocks, eot_block;
  256. +     int user = -1;                /* UID to be forced */
  257. +     int group = -1;                /* GID to be forced */
  258. +     union hblock *hp;            /* To decipher headers */
  259. +     char tape[NAMSIZ];            /* Name of tape device */
  260. +     char ignore = 0;            /* Do not ignore EOT */
  261. +     char relative = 0;            /* Do not remove leading '/' */
  262. +     int nblock = 0;                /* Number of blocks written */
  263. +     strcpy(tape, default_tape);    /* Default device file */
  264. +     logf = stderr;                /* Default logging on stderr */
  265. +     i = 1;
  266. +     
  267. +     /* get arguments */
  268. +     while (argc > i && argv[i][0] == '-') {
  269. +         switch (argv[i][1]) {
  270. +             case 'f' : 
  271. +                 if (argc > i + 1) {
  272. +                     strcpy(tape,argv[++i]);
  273. +                     }
  274. +                 else {
  275. +                     fprintf(stderr, "No tape drive name given\n");
  276. +                     exit(10);
  277. +                 }
  278. +                 break;
  279. +             case 'l':
  280. +                 if (argc > i + 1) {
  281. +                     if ((logf = fopen(argv[++i], "w")) == NULL) {
  282. +                         perror("Can't open log file\n");
  283. +                         exit(11);
  284. +                     }
  285. +                 }
  286. +                 else {
  287. +                     fprintf(stderr, "No log file name given\n");
  288. +                     exit(12);
  289. +                 }
  290. +                 break;
  291. +             case 'i':        /* Ignore end of tape condition */
  292. +                 ignore = 1;
  293. +                 break;
  294. +             case 'r':        /* Force relative paths */
  295. +                 relative = 1;
  296. +                 break;
  297. +             case 'o':        /* Forces ownership */
  298. +                 user = (int) getuid();
  299. +                 group = (int) getgid();
  300. +                 break;
  301. +             case 'u':        /* Force UID on extraction */
  302. +                 if (argc > i + 1) {
  303. +                     sscanf(argv[++i], "%d", &user);
  304. +                     if (user == 0)
  305. +                         user = (int) getuid();    /* Can't give to root */
  306. +                 } else {
  307. +                     fprintf(stderr, "No user ID given\n");
  308. +                     exit(1);
  309. +                 }
  310. +                 break;
  311. +             case 'g':        /* Force GID on extraction */
  312. +                 if (argc > i + 1) {
  313. +                     sscanf(argv[++i], "%d", &group);
  314. +                     if (group == 0)
  315. +                         group = (int) getgid();    /* Can't give to root */
  316. +                 } else {
  317. +                     fprintf(stderr, "No group ID given\n");
  318. +                     exit(1);
  319. +                 }
  320. +                 break;
  321. +             case 'v':        /* Verbose logging */
  322. +                 verbose = 1;
  323. +                 silent = 0;
  324. +                 break;
  325. +             case 's':        /* No logging */
  326. +                 silent = 1;
  327. +                 verbose = 0;
  328. +                 break;
  329. +             case 'h':        /* Print help message */
  330. +                 usage();
  331. +                 exit(0);
  332. +             case 'V':        /* Print version number */
  333. +                 version();
  334. +                 exit(0);
  335. +             default: 
  336. +                 usage();
  337. +                 exit(13);
  338. +         }
  339. +         i++;
  340. +     }
  341. +     
  342. +     /* first char cannot be a 0 */
  343. +     pad[0]  = 'x';
  344. +     
  345. +     /* don't quite know what the tape driver will return, so fill buffer
  346. +        with non zero rubbish
  347. +      */
  348. +     for (i = 0; i < TAPEBLOCK; i++) xbuf[i] = 'x';
  349. +     
  350. +     /* open the tape drive ('-' stands for stdin) */
  351. +     if (0 == strcmp(tape, "-"))
  352. +         fd1 = 0;        /* Standard input */
  353. +     else if ((fd1 = open(tape, O_RDONLY,0)) < 0) {
  354. +         perror("can't open tape");
  355. +         exit(1);
  356. +     }
  357. +     while (1) {
  358. +         fflush(logf);            /* So that they know where we are */
  359. +         hp = (union hblock *) get_next();
  360. +         /* tar tests the first char to see if it is an end of tape (eot) block
  361. +          * or not. Can't see why it doesn't use tape marks. Maybe they weren't
  362. +          * invented when it was written?
  363. +           */
  364. +          /* get a tar block */
  365. +         
  366. +         if (hp->dbuf.name[0] == '\0' && !bad && !fblocks) {
  367. +             /* skip possible eot block (there are two of them) */
  368. +             lprintf(logf, "*** End of tape block\n");
  369. +             eot_block++;
  370. +             if (eot_block < 2)
  371. +                 continue;
  372. +             eot = 1;
  373. +         }
  374. +         /* note if the last block read is bad there may be rubish
  375. +          * (old info from the last write at the end of it) this may cause
  376. +          * some of the last files which are extracted to be partially
  377. +          * overwritten. There is very little one can do about this
  378. +          * (except pray)
  379. +          */
  380. +         
  381. +         /* end of tape ?? */
  382. +         if (eot) {
  383. +             if (fblocks) {
  384. +                 lprintf(logf,"*** Last file Truncated. File padded!!\n");
  385. +                 while (fblocks-- > 0)
  386. +                     nblock++, write(1, pad, TBLOCK);
  387. +             }
  388. +             if (!ignore) {
  389. +                 /* write two blank (eot) blocks */
  390. +                 pad[0] = '\0';
  391. +                 nblock++, write(1, pad, TBLOCK);
  392. +                 nblock++, write(1, pad, TBLOCK);
  393. +                 i = BLOCKF - nblock % BLOCKF;    /* Pad if necessary */
  394. +                 if (i < BLOCKF) {
  395. +                     lprintf(logf, "*** Padding %d block%s\n", i, i>1 ? "s":"");
  396. +                     for (; i > 0; i--)
  397. +                         write(1, pad, TBLOCK);
  398. +                 }
  399. +                 lprintf(logf,"*** End of tar\n");
  400. +                 exit(0);        /* OK */
  401. +             } else {
  402. +                 lprintf(logf,"*** Ignoring end of tar\n");
  403. +                 fblocks = 0;        /* You never know */
  404. +                 eot = 0;            /* I said: ignore EOT !! */
  405. +                 eot_block = 0;
  406. +                 continue;
  407. +             }
  408. +         }
  409. +         
  410. +         /* We need two consecutive EOT blocks for eot
  411. +          * condition to occur
  412. +          */
  413. +         eot_block = 0;
  414. +         
  415. +         /* decode header informations */
  416. +         sscanf(hp->dbuf.size, "%lo", &size);
  417. +         sscanf(hp->dbuf.chksum, "%o", &chksum);
  418. +         if (fblocks > 0 && !bad) { /* all ok in the middle of a file */
  419. +             nblock++, write(1, hp, TBLOCK);
  420. +             fblocks--;
  421. +             /* header inside file ? */
  422. +             if (check_sum(hp) == chksum && hp->dbuf.name[0] != '\0')
  423. +                 lprintf(logf, "*** Warning: Header found inside file!!\n");
  424. +             continue;
  425. +         }
  426. +         
  427. +         /* have we got a header ?? */
  428. +         if (check_sum(hp) == chksum && hp->dbuf.name[0] != '\0') {
  429. +             if (verbose) {
  430. +                 /* Write some informations about the header we've got */
  431. +                 fprintf(logf, "*** Header found.\n");
  432. +                 fprintf(logf, "***   Name: %s\n", hp->dbuf.name);
  433. +                 fprintf(logf, "***   Size: %d\n", size);
  434. +                 fprintf(logf, "***   Mode: %s\n", hp->dbuf.mode);
  435. +                 fprintf(logf, "***   Link flag: %c\n", hp->dbuf.linkflag);
  436. +             }
  437. +             /* we have a header */
  438. +             if (fblocks > 0) {
  439. +                 lprintf(logf, "*** Truncated!! File padded!!\n");
  440. +                 while (fblocks-- > 0)
  441. +                     nblock++, write(1, pad, TBLOCK);
  442. +             }
  443. +             /* If membership has to be overwritten, do it now */
  444. +             if (user != -1 || group != -1) {
  445. +                 if (user != -1)
  446. +                     sprintf(hp->dbuf.uid, "%o", user);
  447. +                 if (group != -1)
  448. +                     sprintf(hp->dbuf.gid, "%o", group);
  449. +                 sprintf(hp->dbuf.chksum, "%o", check_sum(hp));
  450. +             }
  451. +             /* Remove the leading '/' to get non absolute path */
  452. +             if (relative && hp->dbuf.name[0] == '/') {
  453. +                 sprintf(hp->dbuf.name, "%s", hp->dbuf.name + 1);
  454. +                 sprintf(hp->dbuf.chksum, "%o", check_sum(hp));
  455. +             }
  456. +             /* Compute number of blocks used by the file */
  457. +             fblocks = (size%TBLOCK) ? size/TBLOCK + 1 : size/TBLOCK;
  458. +             lprintf(logf,"%s (%d bytes)\n", hp->dbuf.name, size);
  459. +             nblock++, write(1, hp, TBLOCK);        /* Write the header */
  460. +             continue;
  461. +         }
  462. +         
  463. +         /* not a header */
  464. +         if (fblocks <= 0) {
  465. +             /* throw it away! */
  466. +             lprintf(logf, "*** Deleted block!!\n");
  467. +             fblocks = 0;    /* It can't be < 0, but you know... */
  468. +             continue;
  469. +         }
  470. +         lprintf(logf, "***  Writing possibly bad block!!\n");
  471. +         fblocks--;
  472. +         nblock++, write(1, hp, TBLOCK);
  473. +     }
  474. + }
  475.  
  476. Index: Configure
  477. Prereq: 2.0.1.4
  478. *** Configure.old    Sat Jan 11 19:23:59 1992
  479. --- Configure    Sat Jan 11 19:24:01 1992
  480. ***************
  481. *** 16,24 ****
  482.   # Write to ram@eiffel.com (Raphael Manfredi) and I will send you the
  483.   # latest revision of the dist package, which includes metaconfig.)
  484.   
  485. ! # $Id: Configure,v 2.0.1.4 91/11/25 15:48:25 ram Exp $
  486.   #
  487. ! # Generated on Mon Nov 25 15:43:33 PST 1991 [metaconfig 2.8 PL11]
  488.   
  489.   cat >/tmp/c1$$ <<EOF
  490.   
  491. --- 16,24 ----
  492.   # Write to ram@eiffel.com (Raphael Manfredi) and I will send you the
  493.   # latest revision of the dist package, which includes metaconfig.)
  494.   
  495. ! # $Id: Configure,v 2.0.1.5 92/01/11 19:08:09 ram Exp $
  496.   #
  497. ! # Generated on Sat Jan 11 19:03:07 PST 1992 [metaconfig 2.8 PL13]
  498.   
  499.   cat >/tmp/c1$$ <<EOF
  500.   
  501. ***************
  502. *** 150,163 ****
  503. --- 150,166 ----
  504.   contains=''
  505.   cppstdin=''
  506.   cppminus=''
  507. + d_bcopy=''
  508.   d_getopt=''
  509.   d_index=''
  510.   d_memcpy=''
  511.   d_memset=''
  512. + d_perror=''
  513.   d_portable=''
  514.   d_voidsig=''
  515.   signal_t=''
  516.   defeditor=''
  517. + i_fcntl=''
  518.   i_string=''
  519.   strings=''
  520.   i_sysioctl=''
  521. ***************
  522. *** 191,197 ****
  523. --- 194,204 ----
  524.   mips_type=''
  525.   voidflags=''
  526.   defvoidused=''
  527. + needbtar=''
  528. + wantbtar=''
  529.   d_taropt_o=''
  530. + hasdes=''
  531. + tapedev=''
  532.   large=''
  533.   d_whoami=''
  534.   i_sysselct=''
  535. ***************
  536. *** 661,666 ****
  537. --- 668,674 ----
  538.           cp ../config.sh .
  539.           n="$tmp"
  540.           c="$ans"
  541. +         hint=previous
  542.           ;;
  543.       esac
  544.   fi
  545. ***************
  546. *** 1200,1205 ****
  547. --- 1208,1215 ----
  548.           nm_opt=''
  549.       elif $test -d /usr/ccs/lib; then
  550.           nm_opt='-p'
  551. +     elif $test -f /dgux; then
  552. +         nm_opt='-p'
  553.       else
  554.           nm_opt=''
  555.       fi;;
  556. ***************
  557. *** 1437,1442 ****
  558. --- 1447,1464 ----
  559.   else echo "$1() not found.";
  560.       eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi'
  561.   
  562. + : see if bcopy exists
  563. + case "$d_bcopy" in
  564. + $define) d_bcopy="$undef";;
  565. + $undef) d_bcopy="$define";;
  566. + esac
  567. + set bcopy d_bcopy
  568. + eval $inlibc
  569. + case "$d_bcopy" in
  570. + $define) d_bcopy="$undef";;
  571. + *) d_bcopy="$define";;
  572. + esac
  573.   : see if getopt exists
  574.   set getopt d_getopt
  575.   eval $inlibc
  576. ***************
  577. *** 1522,1527 ****
  578. --- 1544,1571 ----
  579.   set memset d_memset
  580.   eval $inlibc
  581.   
  582. + : see if perror exists
  583. + echo " "
  584. + if $contains '^perror$' libc.list >/dev/null 2>&1; then
  585. +     echo 'perror() found.'
  586. +     d_perror="$undef"
  587. + else
  588. +     echo "perror() not found -- Won't be able to give precise error messages."
  589. +     d_perror="$define"
  590. + fi
  591. + : see if this is an fcntl system
  592. + echo " "
  593. + if $test -r $usrinc/fcntl.h ; then
  594. +     val="$define"
  595. +     echo "<fcntl.h> found."
  596. + else
  597. +     val="$undef"
  598. +     echo "No <fcntl.h> found, but that's ok."
  599. + fi
  600. + set i_fcntl
  601. + eval $setvar
  602.   : see how we invoke the C preprocessor
  603.   echo " "
  604.   echo "Now, how can we feed standard input to your C preprocessor..."
  605. ***************
  606. *** 1758,1763 ****
  607. --- 1802,1828 ----
  608.   eval $setvar
  609.   $rm -f $$.tmp
  610.   
  611. + : locate the default tape device
  612. + echo " "
  613. + case "$tapedev" in
  614. + '') if set x /dev/rst*; shift; $test -c "$1"; then
  615. +         dflt="$1";
  616. +     elif set x /dev/rmt*; shift; $test -c "$1"; then
  617. +         dflt="$1";
  618. +     elif set x /dev/rmt/m*; shift; $test -c "$1"; then
  619. +         dflt="$1";
  620. +     elif set x /dev/rmt/?; shift; $test -c "$1"; then
  621. +         dflt="$1";
  622. +     else
  623. +         dflt="/dev/rmt8";
  624. +     fi
  625. +     ;;
  626. + *) dflt="$tapedev";;
  627. + esac
  628. + rp='Where is your tape device located?'
  629. + . myread
  630. + tapedev="$ans"
  631.   : check for void type
  632.   echo " "
  633.   $cat <<EOM
  634. ***************
  635. *** 1879,1884 ****
  636. --- 1944,1977 ----
  637.       fi
  638.   done
  639.   
  640. + : decide how portable to be
  641. + case "$d_portable" in
  642. + "$define") dflt=y;;
  643. + *)    dflt=n;;
  644. + esac
  645. + $cat <<'EOH'
  646. +  
  647. + I can set things up so that your shell scripts and binaries are more portable,
  648. + at what may be a noticable cost in performance.  In particular, if you
  649. + ask to be portable, the following happens:
  650. +      1) Shell scripts will rely on the PATH variable rather than using
  651. +     the paths derived above.
  652. +      2) ~username interpretations will be done at run time rather than
  653. +     by Configure.
  654. + EOH
  655. + rp="Do you expect to run these scripts and binaries on multiple machines?"
  656. + . myread
  657. + case "$ans" in
  658. +     y*) d_portable="$define"
  659. +     for file in $loclist; do
  660. +         eval $file=$file
  661. +     done
  662. +     ;;
  663. +     *)  d_portable="$undef" ;;
  664. + esac
  665.   : see if we need -o option for tar
  666.   echo " "
  667.   case "$d_taropt_o" in
  668. ***************
  669. *** 1930,1935 ****
  670. --- 2023,2084 ----
  671.       fi
  672.   done
  673.   
  674. + : see if des is there and compatible
  675. + echo " "
  676. + case "$hasdes" in
  677. + '') hasdes=false
  678. +     xxx=`loc des x $pth`
  679. +     case "$xxx" in
  680. +     /*) echo "I see you already have a DES in $xxx."
  681. +         echo "Let's make sure it is compatible with mine..."
  682. +         $cat > dedes.c <<EOP
  683. + #include <stdio.h>
  684. + main()
  685. + {
  686. +     char s[10];
  687. +     int c;
  688. +     while (gets(s)) {
  689. +         sscanf(s, "%d", &c);
  690. +         putchar(c);
  691. +     }
  692. + }
  693. + EOP
  694. +         if $cc -o dedes dedes.c >/dev/null 2>&1; then
  695. +             echo "This is a DES try" > des.1
  696. +             $tr ' ' '\012' >des.data <<EOD
  697. + 237 195 33 239 62 135 8 90 191 42 108 230 24 121 207 173 18 98
  698. + 224 166 63 115 153 79
  699. + EOD
  700. +             ./dedes >des.input <des.data
  701. +             $xxx -d -k foo <des.input > des.2 2>&1
  702. +             if cmp -s des.1 des.2 >/dev/null 2>&1; then
  703. +                 echo "Yes, it is! We won't need mine then."
  704. +                 hasdes=true
  705. +             else
  706. +                 echo "No, it isn't!! But that's ok, I'll use my own version."
  707. +                 hasdes=false
  708. +             fi
  709. +         else
  710. +             echo "(I can't seem to compile the test program--Using your DES)"
  711. +             hasdes=true
  712. +         fi
  713. +         ;;
  714. +     *) echo "I don't see any DES implementation out there. I'll use mine."
  715. +         ;;
  716. +     esac
  717. +     ;;
  718. + *) case "$hasdes" in
  719. +     true) echo "I already know that your DES is compatible with mine.";;
  720. +     *) $cat <<EOM
  721. + As before, I'm going to use the DES implementation provided with $package.
  722. + EOM
  723. +     ;;
  724. +     esac
  725. +     ;;
  726. + esac
  727. + $rm -f dedes.c dedes des.data des.input des.1 des.2
  728.   : determine the name of a reasonable mailer
  729.   case "$mailer" in
  730.   '')
  731. ***************
  732. *** 2024,2055 ****
  733.   *) manext=1;;
  734.   esac
  735.   
  736. ! : decide how portable to be
  737. ! case "$d_portable" in
  738. ! "$define") dflt=y;;
  739. ! *)    dflt=n;;
  740.   esac
  741. ! $cat <<'EOH'
  742. !  
  743. ! I can set things up so that your shell scripts and binaries are more portable,
  744. ! at what may be a noticable cost in performance.  In particular, if you
  745. ! ask to be portable, the following happens:
  746.   
  747. !      1) Shell scripts will rely on the PATH variable rather than using
  748. !     the paths derived above.
  749. !      2) ~username interpretations will be done at run time rather than
  750. !     by Configure.
  751.   
  752. ! EOH
  753. ! rp="Do you expect to run these scripts and binaries on multiple machines?"
  754. ! . myread
  755. ! case "$ans" in
  756. !     y*) d_portable="$define"
  757. !     for file in $loclist; do
  758. !         eval $file=$file
  759. !     done
  760.       ;;
  761. -     *)  d_portable="$undef" ;;
  762.   esac
  763.   
  764.   : determine where private executables go
  765. --- 2173,2232 ----
  766.   *) manext=1;;
  767.   esac
  768.   
  769. ! : see if we need badtar
  770. ! echo " "
  771. ! case "$needbtar" in
  772. ! '') xxx=''
  773. !     case "$d_taropt_o" in
  774. !     "$define") xxx='o';;
  775. !     esac
  776. !     echo "Checking to see how well 'tar x${xxx}f' sets ownership..."
  777. !     (cd /bin; $tar cf - rm) | eval "$tar x${xxx}f -"
  778. !     needbtar='true'
  779. !     if test -f rm; then
  780. !         (cd /bin; ls -l rm) > rm.orig
  781. !         ls -l rm > rm.now
  782. !         if cmp rm.orig rm.now >/dev/null 2>&1; then
  783. !         echo "Your tar does not seem to overwrite ownership -- I'll use badtar."
  784. !         else
  785. !             echo "Your tar works fine."
  786. !             needbtar='false'
  787. !         fi
  788. !     else
  789. !         echo "(My test failed -- Using badtar, just in case.)"
  790. !     fi
  791. !     ;;
  792. ! *) case "$needbtar" in
  793. !     true) echo "I'll pipe badtar's output to tar, so that things run smoothly."
  794. !         ;;
  795. !     *) echo "I'll trust your tar to overwrite file ownership."
  796. !         ;;
  797. !     esac
  798. !     ;;
  799.   esac
  800. ! $rm -f rm rm.orig rm.now
  801.   
  802. ! : does the user want badtar ?
  803. ! wantbtar='true'
  804. ! case "$needbtar" in
  805. ! true) ;;
  806. ! *) $cat <<EOM
  807. ! $package comes with badtar, a program which repairs damaged tar files. You
  808. ! do not need it to run $package, but you may want to compile and install it
  809. ! anyway. Badtar has its output piped to tar and does some kind of filterting,
  810. ! like padding files (assuming some blocks on the tape could not be read),
  811. ! stripping down absolute paths to relative ones by removing the leading '/',
  812. ! or simply overwriting the ownership of the files. It comes with a manual page.
  813.   
  814. ! EOM
  815. !     dflt='y'
  816. !     rp='Would you like to have badtar installed?'
  817. !     . myread
  818. !     case "$and" in
  819. !     n*|N*) wantbtar='false';;
  820. !     esac
  821.       ;;
  822.   esac
  823.   
  824.   : determine where private executables go
  825. ***************
  826. *** 2219,2232 ****
  827. --- 2396,2412 ----
  828.   contains='$contains'
  829.   cppstdin='$cppstdin'
  830.   cppminus='$cppminus'
  831. + d_bcopy='$d_bcopy'
  832.   d_getopt='$d_getopt'
  833.   d_index='$d_index'
  834.   d_memcpy='$d_memcpy'
  835.   d_memset='$d_memset'
  836. + d_perror='$d_perror'
  837.   d_portable='$d_portable'
  838.   d_voidsig='$d_voidsig'
  839.   signal_t='$signal_t'
  840.   defeditor='$defeditor'
  841. + i_fcntl='$i_fcntl'
  842.   i_string='$i_string'
  843.   strings='$strings'
  844.   i_sysioctl='$i_sysioctl'
  845. ***************
  846. *** 2260,2266 ****
  847. --- 2440,2450 ----
  848.   mips_type='$mips_type'
  849.   voidflags='$voidflags'
  850.   defvoidused='$defvoidused'
  851. + needbtar='$needbtar'
  852. + wantbtar='$wantbtar'
  853.   d_taropt_o='$d_taropt_o'
  854. + hasdes='$hasdes'
  855. + tapedev='$tapedev'
  856.   EOT
  857.   
  858.   : add special variables
  859.  
  860. Index: kit/kit.SH
  861. Prereq: 2.0.1.6
  862. *** kit/kit.SH.old    Sat Jan 11 19:24:40 1992
  863. --- kit/kit.SH    Sat Jan 11 19:24:41 1992
  864. ***************
  865. *** 26,34 ****
  866.   !GROK!THIS!
  867.   $spitshell >>kit <<'!NO!SUBS!'
  868.   
  869. ! # $Id: kit.SH,v 2.0.1.6 91/12/08 14:55:06 ram Exp $
  870.   #
  871.   # $Log:    kit.SH,v $
  872.   # Revision 2.0.1.6  91/12/08  14:55:06  ram
  873.   # patch10: forgot to protect evaluation of variable in a test
  874.   # 
  875. --- 26,37 ----
  876.   !GROK!THIS!
  877.   $spitshell >>kit <<'!NO!SUBS!'
  878.   
  879. ! # $Id: kit.SH,v 2.0.1.7 92/01/11 19:17:20 ram Exp $
  880.   #
  881.   # $Log:    kit.SH,v $
  882. + # Revision 2.0.1.7  92/01/11  19:17:20  ram
  883. + # patch11: now uses makeshar when cshar is not installed
  884. + # 
  885.   # Revision 2.0.1.6  91/12/08  14:55:06  ram
  886.   # patch10: forgot to protect evaluation of variable in a test
  887.   # 
  888. ***************
  889. *** 174,179 ****
  890. --- 177,185 ----
  891.           ;;
  892.       -*) echo "unkown option $1"
  893.           eval $usage
  894. +         ;;
  895. +     *) break
  896. +         ;;
  897.       esac
  898.   done
  899.   
  900. ***************
  901. *** 242,252 ****
  902.       fi
  903.   fi
  904.   
  905.   echo "Coding with $coding"
  906.   # Beware: 'eval $coding < $tmpfile' is not portable
  907.   cat $tmpfile | eval $coding |
  908.   split -600 - $split_file &&
  909. ! makekit -k100 -n $partname ${split_file}* $minikit $mininame &&
  910.   rm ${split_file}* $minikit $mininame $tmpfile
  911.   
  912.   case "$subject" in
  913. --- 248,265 ----
  914.       fi
  915.   fi
  916.   
  917. + # Check whether we can use cshar or not
  918. + if (makekit -v) >/dev/null 2>&1; then
  919. +     makekit="makekit -k100 -n $partname ${split_file}* $minikit $mininame"
  920. + else
  921. +     makekit="$libdir/makeshar -n $partname ${split_file}* $minikit $mininame"
  922. + fi
  923.   echo "Coding with $coding"
  924.   # Beware: 'eval $coding < $tmpfile' is not portable
  925.   cat $tmpfile | eval $coding |
  926.   split -600 - $split_file &&
  927. ! eval $makekit &&
  928.   rm ${split_file}* $minikit $mininame $tmpfile
  929.   
  930.   case "$subject" in
  931.  
  932. Index: man/kit.SH
  933. Prereq: 2.0.1.5
  934. *** man/kit.SH.old    Sat Jan 11 19:24:57 1992
  935. --- man/kit.SH    Sat Jan 11 19:24:59 1992
  936. ***************
  937. *** 18,26 ****
  938.   .TH KIT $manext ram
  939.   ''' @(#) Manual page for mailing kit -- (c) ram July 1990
  940.   '''
  941. ! ''' $Id: kit.SH,v 2.0.1.5 91/11/25 15:53:01 ram Exp $
  942.   '''
  943.   ''' $Log:    kit.SH,v $
  944.   ''' Revision 2.0.1.5  91/11/25  15:53:01  ram
  945.   ''' patch9: added kit's -M option to include minikit
  946.   ''' patch9: documents the tar -o possible problem
  947. --- 18,30 ----
  948.   .TH KIT $manext ram
  949.   ''' @(#) Manual page for mailing kit -- (c) ram July 1990
  950.   '''
  951. ! ''' $Id: kit.SH,v 2.0.1.6 92/01/11 19:22:08 ram Exp $
  952.   '''
  953.   ''' $Log:    kit.SH,v $
  954. + ''' Revision 2.0.1.6  92/01/11  19:22:08  ram
  955. + ''' patch11: the .so directive was made relative to make man happy
  956. + ''' patch11: documents badtar and cshar-emulating scripts
  957. + ''' 
  958.   ''' Revision 2.0.1.5  91/11/25  15:53:01  ram
  959.   ''' patch9: added kit's -M option to include minikit
  960.   ''' patch9: documents the tar -o possible problem
  961. ***************
  962. *** 58,64 ****
  963.   \fBmailkit\fR [ \fB\-EFVefhp\fR ] [ \fB\-l\fI file\fR ]
  964.   [ \fB\-n\fI partname\fR ] \fItitle\fR [ \fIaddress(es)\fR ]
  965.   .br
  966. ! \fBunkit\fR [ \fB\-hlprV\fR ] [ \fIfiles\fR ]
  967.   .SH DESCRIPTION
  968.   \fIKit\fR is the ultimate mailing tool. It enables you to mail
  969.   data without any consideration of possible escape sequences or
  970. --- 62,68 ----
  971.   \fBmailkit\fR [ \fB\-EFVefhp\fR ] [ \fB\-l\fI file\fR ]
  972.   [ \fB\-n\fI partname\fR ] \fItitle\fR [ \fIaddress(es)\fR ]
  973.   .br
  974. ! \fBunkit\fR [ \fB\-bhlprV\fR ] [ \fIfiles\fR ]
  975.   .SH DESCRIPTION
  976.   \fIKit\fR is the ultimate mailing tool. It enables you to mail
  977.   data without any consideration of possible escape sequences or
  978. ***************
  979. *** 66,73 ****
  980.   Given a file name or a directory, it builds a single file using
  981.   \fItar\fR(1) and \fIcompress\fR(1). Then this file is hex-encoded
  982.   (option \fB\-H\fR) or ASCII-encoded with \fIbtoa\fR(1)
  983. ! (option \fB\-B\fR, which is used by default) before being shell-archived
  984. ! by \fImakekit\fR(1).
  985.   \fIKit\fR produces files that match "Kit*" regular expression.
  986.   This default base name can be changed thanks to \fB\-n\fR option.
  987.   On invocation, it removes all previously existing "Kit*" files.
  988. --- 70,76 ----
  989.   Given a file name or a directory, it builds a single file using
  990.   \fItar\fR(1) and \fIcompress\fR(1). Then this file is hex-encoded
  991.   (option \fB\-H\fR) or ASCII-encoded with \fIbtoa\fR(1)
  992. ! (option \fB\-B\fR, which is used by default) before being shell-archived.
  993.   \fIKit\fR produces files that match "Kit*" regular expression.
  994.   This default base name can be changed thanks to \fB\-n\fR option.
  995.   On invocation, it removes all previously existing "Kit*" files.
  996. ***************
  997. *** 126,131 ****
  998. --- 129,139 ----
  999.   the message will be sent in an extra part (#0), while with \fB\-e\fR
  1000.   it will be included in each part. Empty messages will be ignored.
  1001.   .PP
  1002. + Options \fB\-F\fR and \fB\-f\fR are very similar, but take their
  1003. + input from stdin (standard input) instead of calling an editor.
  1004. + Option \fB\-p\fR asks \fImailkit\fR for preserving mailed files. They
  1005. + are removed by default.
  1006. + .PP
  1007.   When \fImailkit\fR is given a \fB\-l\fR option, it takes the file name
  1008.   as a file whith recipients addresses in it and adds the optional addresses that
  1009.   may be given on the command line. Addresses in the recipient file are
  1010. ***************
  1011. *** 132,142 ****
  1012.   separated with spaces, commas or new lines. Shell-style comments starting with
  1013.   a pound sign (#) are allowed.
  1014.   .PP
  1015. - Options \fB\-F\fR and \fB\-f\fR are very similar, but take their
  1016. - input from stdin (standard input) instead of calling an editor.
  1017. - Option \fB\-p\fR asks \fImailkit\fR for preserving mailed files. They
  1018. - are removed by default.
  1019. - .PP
  1020.   \fIUnkit\fR is used to restore the original files. The argument is
  1021.   a list of archive files (or mail files, as \fIunshar\fR(1), which
  1022.   is called by \fIunkit\fR, can deal with mail headers).
  1023. --- 140,145 ----
  1024. ***************
  1025. *** 145,150 ****
  1026. --- 148,160 ----
  1027.   If no file name is given to \fIunkit\fR, the standard input is processed.
  1028.   This is useful to process messages directly from a mail user agent.
  1029.   .PP
  1030. + Sometimes, \fItar\fR does not work well accross NFS and will fail restoring
  1031. + ownership on files, even with the \-\fBo\fR option. If you chose to install
  1032. + \fIbadtar\fR at configuration time, you may use \-\fBb\fR to instruct
  1033. + \fIunkit\fR using \fIbadtar\fR as a filter before running \fItar\fR. This is
  1034. + the default action on some systems (the \-\fBh\fR option will tell you
  1035. + what was determined at configuration time).
  1036. + .PP
  1037.   If you want to know what \fIunkit\fR will create without actually
  1038.   doing it, use the \fB\-l\fR option. With this option, \fB\-r\fR is
  1039.   ignored.
  1040. ***************
  1041. *** 181,192 ****
  1042.   $privlib/minikit
  1043.   the script which may be used to unkit a distribution when the kit
  1044.   package is not available.
  1045.   .PD
  1046.   .SH NOTE
  1047.   .PP
  1048. ! In order to use kit, you need to install \fBcshar\fR in your
  1049. ! PATH (programs needed are \fIshar\fR, \fImakekit\fR).
  1050. ! Moreover, \fIhexdecode\fR, \fIhexencode\fR, \fIatob\fR and \fIbtoa\fR
  1051.   must be installed and \fIcompress\fR must be available.
  1052.   If any of these is missing, this mailing kit is useless.
  1053.   .PP
  1054. --- 191,214 ----
  1055.   $privlib/minikit
  1056.   the script which may be used to unkit a distribution when the kit
  1057.   package is not available.
  1058. + .TP
  1059. + $privlib/makeshar
  1060. + the script which emulates \fIcshar\fR's \fImakekit\fR program.
  1061. + .TP
  1062. + $privlib/rshar
  1063. + a simple shell archive maker.
  1064.   .PD
  1065.   .SH NOTE
  1066.   .PP
  1067. ! Kit may now be used as a standalone package, i.e. without the help of
  1068. ! the \fIcshar\fR distribution.
  1069. ! This was not true before version 2.0 PL10. Two simple shell scripts
  1070. ! now emulate \fIcshar\fR's behaviour. Those scripts are held in the
  1071. ! private library directory because they are not intended to be used
  1072. ! directly by any user.
  1073. ! .PP
  1074. ! In order to use kit, \fIhexdecode\fR, \fIhexencode\fR,
  1075. ! \fIatob\fR and \fIbtoa\fR
  1076.   must be installed and \fIcompress\fR must be available.
  1077.   If any of these is missing, this mailing kit is useless.
  1078.   .PP
  1079. ***************
  1080. *** 247,253 ****
  1081.   .SH AUTHOR
  1082.   Raphael Manfredi <ram@eiffel.com>.
  1083.   
  1084. ! \fIKit\fR was developed at the Ecole des Mines, Saint-Etienne,
  1085. ! France.
  1086.   !GROK!THIS!
  1087.   chmod 444 kit.$manext
  1088. --- 269,276 ----
  1089.   .SH AUTHOR
  1090.   Raphael Manfredi <ram@eiffel.com>.
  1091.   
  1092. ! \fIKit\fR was first developed at the Ecole des Mines, Saint-Etienne,
  1093. ! France. Many improvements were added at Interactive Software
  1094. ! Engineering Inc., Santa-Barbara CA, USA.
  1095.   !GROK!THIS!
  1096.   chmod 444 kit.$manext
  1097.  
  1098. Index: README
  1099. *** README.old    Sat Jan 11 19:24:11 1992
  1100. --- README    Sat Jan 11 19:24:12 1992
  1101. ***************
  1102. *** 1,11 ****
  1103.                                kit 2.0
  1104.   
  1105. !              Copyright (c) 1990 1991, Raphael Manfredi
  1106.   
  1107.   You may copy this kit in whole or in part as long as you don't try to
  1108.   make money off it, or pretend you wrote it.
  1109.   ------------------------------------------------------------------------
  1110. ! The ultimate mailing kit -- Assumes you own cshar (written by Rich Salz)
  1111.   
  1112.   Please read all the directions below before you proceed any further, and
  1113.   then follow them carefully.
  1114. --- 1,11 ----
  1115.                                kit 2.0
  1116.   
  1117. !            Copyright (c) 1990 1991 1992, Raphael Manfredi
  1118.   
  1119.   You may copy this kit in whole or in part as long as you don't try to
  1120.   make money off it, or pretend you wrote it.
  1121.   ------------------------------------------------------------------------
  1122. !                       The ultimate mailing kit
  1123.   
  1124.   Please read all the directions below before you proceed any further, and
  1125.   then follow them carefully.
  1126. ***************
  1127. *** 13,24 ****
  1128.   After you have unpacked your kit, you should have all the files listed
  1129.   in MANIFEST.
  1130.   
  1131. ! If you only wish to use unkit, then CSHAR is not necessary, though
  1132. ! strongly recommended.
  1133.   
  1134. ! In order to use kit, you need to install CSHAR in your PATH (programs
  1135. ! needed are shar, makekit and unshar). Compress must be available. If you
  1136. ! miss one of those, send me a mail: ram@eiffel.com (Raphael Manfredi).
  1137.   
  1138.   Moreover, hexdecode, hexencode, atob and btoa must be installed. The
  1139.   public-domain implementation of des, which is provided with kit, must
  1140. --- 13,25 ----
  1141.   After you have unpacked your kit, you should have all the files listed
  1142.   in MANIFEST.
  1143.   
  1144. ! Kit used to rely on Rich Salz's cshar package but is now self-contained.
  1145. ! However, if you have the opportunity to get cshar, I would recommend its
  1146. ! installation. Kit will automatically use the tools from cshar when they
  1147. ! are available.
  1148.   
  1149. ! In order to use kit, you must have an implementation of compress. If you
  1150. ! miss it, send me a mail: ram@eiffel.com (Raphael Manfredi).
  1151.   
  1152.   Moreover, hexdecode, hexencode, atob and btoa must be installed. The
  1153.   public-domain implementation of des, which is provided with kit, must
  1154. ***************
  1155. *** 69,81 ****
  1156.   
  1157.   CREDITS
  1158.   
  1159. ! Kit relies on two public-domain softwares:
  1160.   
  1161. !     - cshar, written by Rich Salz.
  1162.       - des, written by Phil Karn, which is provided with kit.
  1163.   
  1164. - To maintain and configure kit, I use the dist 2.0 package written
  1165. - by Larry Wall with some significant changes. If you wish to get a
  1166. - copy of it, feel free to ask me.
  1167.   
  1168. !     -- Raphael
  1169. --- 70,93 ----
  1170.   
  1171.   CREDITS
  1172.   
  1173. ! Kit relies on four public-domain softwares:
  1174.   
  1175. !     - cshar, written by Rich Salz (kit will use it if possible).
  1176.       - des, written by Phil Karn, which is provided with kit.
  1177. +     - btoa (as a stripped down implementation).
  1178. +     - badtar, written by Mike Williams, with a few enhancements.
  1179.   
  1180.   
  1181. ! ACKNOWLEDGMENTS
  1182. ! I would like to thank:
  1183. !     Gary Casterline <casterln@are.berkeley.edu>
  1184. !     Michael Fischer <fischer-michael@cs.yale.edu>
  1185. !     Monty Solomon <monty@bu.edu>
  1186. ! for their bug reports and comments.
  1187. ! The criticism of Tim Kuehn <timk@wynnds.xenitec.on.ca> was also much
  1188. ! appreciated.
  1189. !     Raphael Manfredi <ram@eiffel.com>
  1190.  
  1191. Index: badtar/README
  1192. *** badtar/README.old    Sat Jan 11 19:24:17 1992
  1193. --- badtar/README    Sat Jan 11 19:24:18 1992
  1194. ***************
  1195. *** 0 ****
  1196. --- 1,26 ----
  1197. + The following program can be used to extract files from a tar tape which
  1198. + contains read errors. It is used as a filter whose output should be piped
  1199. + into tar thus:
  1200. +     badtar -f /dev/rmt16 -l log_file | tar xf -
  1201. + This program is not perfect. It cannot read what cannot be read, but it
  1202. + will continue over read errors, pad files to suitable lengths when blocks
  1203. + are missing, ignore files whose header tar blocks are mangled etc...
  1204. + The log file (-l flag) gives a list of all files found, indicates which of 
  1205. + them were padded, shows where blocks were deleted (ie files were lost)
  1206. + and where bad blocks occured on the tape. You can get a good idea from this
  1207. + list where files will have been mangled or lost. All error messages begin with
  1208. + *** which makes life easier to find errors in a long list.
  1209. + Badtar was written by Mike Williams and appeared in net.sources in 1986.
  1210. + I have worked on the code one day I could not read my backup tape... The
  1211. + ownership overwriting has been written specially for kit. Badtar may be
  1212. + used apart from kit, of course, as a standalone tool.
  1213. + If you have suggestions on how to improve badtar, I would be pleased to
  1214. + hear about it. However, I'd like to keep it small, being part of kit
  1215. + delivery.
  1216. +     Raphael Manfredi <ram@eiffel.com>
  1217.  
  1218. Index: shar/README
  1219. *** shar/README.old    Sat Jan 11 19:25:11 1992
  1220. --- shar/README    Sat Jan 11 19:25:11 1992
  1221. ***************
  1222. *** 0 ****
  1223. --- 1,18 ----
  1224. + This directory contains a set of shell scripts which are to be used
  1225. + by kit when cshar is not available. Those scripts are not intended
  1226. + to be executed directly by the user, hence no manual page is provided
  1227. + and the scripts are installed in the private library directory.
  1228. + There should be no difference from the user's point of view when kit
  1229. + uses those scripts instead of the cshar package. The aim was to make
  1230. + kit a self-contained package. When possible however, cshar should be
  1231. + installed. Kit will automatically use cshar whenever it can.
  1232. + In the design of the shell archive produced by rshar, I freely borrowed
  1233. + the style used by Rich Salz in his cshar package. In the makeshar script,
  1234. + the algorithm used to assign each file a part number comes directly from
  1235. + the makedist perl script found in Larry Wall's dist 2.0.
  1236. + The scripts are so small they are installed in the public kit library
  1237. + even if cshar is installed. It might be useful if the kit scripts are
  1238. + shared accross different machines and some do miss cshar.
  1239.  
  1240. Index: Makefile.SH
  1241. Prereq: 2.0.1.4
  1242. *** Makefile.SH.old    Sat Jan 11 19:24:08 1992
  1243. --- Makefile.SH    Sat Jan 11 19:24:08 1992
  1244. ***************
  1245. *** 18,26 ****
  1246.   #    Makefile for kit
  1247.   #
  1248.   
  1249. ! # $Id: Makefile.SH,v 2.0.1.4 91/12/08 14:53:40 ram Exp $
  1250.   #
  1251.   # $Log:    Makefile.SH,v $
  1252.   # Revision 2.0.1.4  91/12/08  14:53:40  ram
  1253.   # patch10: make clobber was not removing cppstdin
  1254.   # 
  1255. --- 18,29 ----
  1256.   #    Makefile for kit
  1257.   #
  1258.   
  1259. ! # $Id: Makefile.SH,v 2.0.1.5 92/01/11 19:08:43 ram Exp $
  1260.   #
  1261.   # $Log:    Makefile.SH,v $
  1262. + # Revision 2.0.1.5  92/01/11  19:08:43  ram
  1263. + # patch11: added subdirectories badtar and shar
  1264. + # 
  1265.   # Revision 2.0.1.4  91/12/08  14:53:40  ram
  1266.   # patch10: make clobber was not removing cppstdin
  1267.   # 
  1268. ***************
  1269. *** 39,45 ****
  1270.   
  1271.   SHELL = /bin/sh
  1272.   
  1273. ! SUBDIRS = btoa kit man des
  1274.   RM = $rm
  1275.   !GROK!THIS!
  1276.   $spitshell >>Makefile <<'!NO!SUBS!'
  1277. --- 42,48 ----
  1278.   
  1279.   SHELL = /bin/sh
  1280.   
  1281. ! SUBDIRS = badtar btoa kit shar man des
  1282.   RM = $rm
  1283.   !GROK!THIS!
  1284.   $spitshell >>Makefile <<'!NO!SUBS!'
  1285.  
  1286. Index: badtar/Makefile.SH
  1287. *** badtar/Makefile.SH.old    Sat Jan 11 19:24:14 1992
  1288. --- badtar/Makefile.SH    Sat Jan 11 19:24:15 1992
  1289. ***************
  1290. *** 0 ****
  1291. --- 1,72 ----
  1292. + case $CONFIG in
  1293. + '')
  1294. +     if test ! -f config.sh; then
  1295. +         ln ../config.sh . || \
  1296. +         ln ../../config.sh . || \
  1297. +         ln ../../../config.sh . || \
  1298. +         (echo "Can't find config.sh."; exit 1)
  1299. +     fi 2>/dev/null
  1300. +     . config.sh
  1301. +     ;;
  1302. + esac
  1303. + case "$0" in
  1304. + */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  1305. + esac
  1306. + echo "Extracting badtar/Makefile (with variable substitutions)"
  1307. + $spitshell >Makefile <<!GROK!THIS!
  1308. + #
  1309. + # Makefile for kit (sub-directory badtar)
  1310. + #
  1311. + # $Id: Makefile.SH,v 2.0.1.1 92/01/11 19:11:57 ram Exp $
  1312. + #
  1313. + # $Log:    Makefile.SH,v $
  1314. + # Revision 2.0.1.1  92/01/11  19:11:57  ram
  1315. + # patch11: created
  1316. + # 
  1317. + SHELL = /bin/sh
  1318. + CC = $cc
  1319. + CFLAGS = $ccflags $optimize
  1320. + RM = $rm
  1321. + bin = $bin
  1322. + man = $mansrc
  1323. + manpage = badtar.$manext
  1324. + !GROK!THIS!
  1325. + case "$wantbtar" in
  1326. + true)
  1327. + $spitshell >>Makefile <<'!NO!SUBS!'
  1328. + all: badtar $(manpage)
  1329. + badtar: badtar.o
  1330. +     $(CC) $(CFLAGS) -o badtar badtar.o
  1331. + $(manpage): badtar.SH
  1332. +     /bin/sh badtar.SH
  1333. + install: badtar $(manpage)
  1334. +     ../install -s -m 755 badtar $(bin)
  1335. +     ../install -m 444 $(manpage) $(man)
  1336. + clean:
  1337. +     rm -f *.o badtar $(manpage)
  1338. + !NO!SUBS!
  1339. +     ;;
  1340. + *)
  1341. + $spitshell >>Makefile <<'!NO!SUBS!'
  1342. + all install clean:
  1343. + !NO!SUBS!
  1344. +     ;;
  1345. + esac
  1346. + $spitshell >>Makefile <<'!NO!SUBS!'
  1347. + realclean clobber: clean
  1348. +     $(RM) -f core Makefile config.sh
  1349. + !NO!SUBS!
  1350. + chmod 755 Makefile
  1351. + $eunicefix Makefile
  1352.  
  1353. Index: des/Makefile.SH
  1354. Prereq: 2.0.1.3
  1355. *** des/Makefile.SH.old    Sat Jan 11 19:24:32 1992
  1356. --- des/Makefile.SH    Sat Jan 11 19:24:32 1992
  1357. ***************
  1358. *** 18,26 ****
  1359.   # Makefile for kit (sub-directory des)
  1360.   #
  1361.   
  1362. ! # $Id: Makefile.SH,v 2.0.1.3 91/11/25 12:03:16 ram Exp $
  1363.   #
  1364.   # $Log:    Makefile.SH,v $
  1365.   # Revision 2.0.1.3  91/11/25  12:03:16  ram
  1366.   # patch8: this file was stamped with a wrong package name
  1367.   # 
  1368. --- 18,29 ----
  1369.   # Makefile for kit (sub-directory des)
  1370.   #
  1371.   
  1372. ! # $Id: Makefile.SH,v 2.0.1.4 92/01/11 19:13:59 ram Exp $
  1373.   #
  1374.   # $Log:    Makefile.SH,v $
  1375. + # Revision 2.0.1.4  92/01/11  19:13:59  ram
  1376. + # patch11: now depends on the 'hasdes' configuration variable
  1377. + # 
  1378.   # Revision 2.0.1.3  91/11/25  12:03:16  ram
  1379.   # patch8: this file was stamped with a wrong package name
  1380.   # 
  1381. ***************
  1382. *** 40,45 ****
  1383. --- 43,50 ----
  1384.   RM = $rm
  1385.   bin = $bin
  1386.   !GROK!THIS!
  1387. + case "$hasdes" in
  1388. + false)
  1389.   $spitshell >>Makefile <<'!NO!SUBS!'
  1390.   
  1391.   all: $(ALL)
  1392. ***************
  1393. *** 61,68 ****
  1394. --- 66,85 ----
  1395.   clean:
  1396.       rm -f *.o des descert
  1397.   
  1398. + !NO!SUBS!
  1399. +     ;;
  1400. + *)
  1401. + $spitshell >>Makefile <<'!NO!SUBS!'
  1402. + all install clean:
  1403. + !NO!SUBS!
  1404. +     ;;
  1405. + esac
  1406. + $spitshell >>Makefile <<'!NO!SUBS!'
  1407.   realclean clobber: clean
  1408.       $(RM) -f certify core Makefile config.sh
  1409.   !NO!SUBS!
  1410.   chmod 755 Makefile
  1411.   $eunicefix Makefile
  1412.  
  1413. Index: shar/Makefile.SH
  1414. *** shar/Makefile.SH.old    Sat Jan 11 19:25:08 1992
  1415. --- shar/Makefile.SH    Sat Jan 11 19:25:08 1992
  1416. ***************
  1417. *** 0 ****
  1418. --- 1,59 ----
  1419. + case $CONFIG in
  1420. + '')
  1421. +     if test ! -f config.sh; then
  1422. +         ln ../config.sh . || \
  1423. +         ln ../../config.sh . || \
  1424. +         ln ../../../config.sh . || \
  1425. +         (echo "Can't find config.sh."; exit 1)
  1426. +     fi
  1427. +     . config.sh
  1428. +     ;;
  1429. + esac
  1430. + case "$0" in
  1431. + */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  1432. + esac
  1433. + echo "Extracting shar/Makefile (with variable substitutions)"
  1434. + $spitshell >Makefile <<!GROK!THIS!
  1435. + #
  1436. + # Makefile for kit (sub-directory shar)
  1437. + #
  1438. + # $Id: Makefile.SH,v 2.0.1.1 92/01/11 19:22:47 ram Exp $
  1439. + #
  1440. + # $Log:    Makefile.SH,v $
  1441. + # Revision 2.0.1.1  92/01/11  19:22:47  ram
  1442. + # patch11: created
  1443. + # 
  1444. + SHELL = /bin/sh
  1445. + RM = $rm
  1446. + libdir = $privlib
  1447. + !GROK!THIS!
  1448. + $spitshell >>Makefile <<'!NO!SUBS!'
  1449. + scripts = makeshar rshar
  1450. + scriptsh = makeshar.SH rshar.SH
  1451. + added = Makefile config.sh
  1452. + all: $(scripts)
  1453. + makeshar: makeshar.SH
  1454. +     sh $@.SH
  1455. + rshar: rshar.SH
  1456. +     sh $@.SH
  1457. + install: $(scripts)
  1458. +     -for file in $(scripts); do \
  1459. +         ../install -m 555 $$file $(libdir); \
  1460. +     done
  1461. + clean:
  1462. +     $(RM) -f $(scripts)
  1463. + realclean clobber: clean
  1464. +     $(RM) -f $(added)
  1465. + !NO!SUBS!
  1466. + chmod 755 Makefile
  1467. + $eunicefix Makefile
  1468.  
  1469. Index: MANIFEST
  1470. *** MANIFEST.old    Sat Jan 11 19:25:20 1992
  1471. --- MANIFEST    Sat Jan 11 19:25:21 1992
  1472. ***************
  1473. *** 2,7 ****
  1474. --- 2,11 ----
  1475.   MANIFEST                   This shipping list
  1476.   Configure                  Portability tool
  1477.   Makefile.SH                Main makefile
  1478. + badtar/Makefile.SH         Makefile for badtar
  1479. + badtar/README              Informations on badtar
  1480. + badtar/badtar.SH           Manual page for badtar
  1481. + badtar/badtar.c            A program to repair damaged tar files
  1482.   btoa/Makefile.SH           Makefile for btoa and al.
  1483.   btoa/atob.c                For ascii to binary decoding
  1484.   btoa/btoa.c                For binary to ascii encoding
  1485. ***************
  1486. *** 32,34 ****
  1487. --- 36,42 ----
  1488.   man/mailkit.SH             The manual page for "mailkit"
  1489.   man/unkit.SH               The manual page for "unkit"
  1490.   patchlevel.h               Current patch level value
  1491. + shar/Makefile.SH           Makefile for shar
  1492. + shar/README                Purpose of the shar scripts
  1493. + shar/makeshar.SH           Builds a set of shar files
  1494. + shar/rshar.SH              A simple shar program
  1495.  
  1496. *** End of Patch 11 ***
  1497.