home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / uumail4 / part03 < prev    next >
Encoding:
Internet Message Format  |  1987-02-04  |  48.9 KB

  1. Subject:  v08i035:  Uumail release 4.2, Part03/04
  2. Newsgroups: mod.sources
  3. Approved: mirror!rs
  4.  
  5. Submitted by: sob@soma.BCM.TMC.EDU (Stan Barber)
  6. Mod.sources: Volume 8, Issue 35
  7. Archive-name: uumail4/Part03
  8.  
  9. [  IMPORTANT NOTE:  This version superceeds the recent net.sources posting
  10.    because it also inclues the Patch#1.  An earlier version of Uumail
  11.    was next in the backlog, hence this "rapid" posting.  --r$  ]
  12.  
  13. #! /bin/sh
  14.  
  15. # Make a new directory for the uumail sources, cd to it, 
  16. # and run kits 1 thru 4 through sh. 
  17. # When all 4 kits have been run, read README.
  18.  
  19. echo "This is uumail kit 3 (of 4).  If kit 3 is complete, the line"
  20. echo '"'"End of kit 3 (of 4)"'" will echo at the end.'
  21. echo ""
  22. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  23. echo Extracting alias.c
  24. cat >alias.c <<'!STUFFY!FUNK!'
  25. #include "uuconf.h"
  26. #ifndef lint
  27. static char rcsid[] = "$Header: alias.c,v 4.0 86/11/17 16:02:00 sob Exp $";
  28. #endif
  29. /***************************************************************************
  30. This work in its current form is Copyright 1986 Stan Barber
  31. with the exception of opath, gethostname and the original getpath which
  32. as far as I know are in the Public Domain. This software may be distributed
  33. freely as long as no profit is made from such distribution and this notice
  34. is reproducted in whole.
  35. ***************************************************************************
  36. This software is provided on an "as is" basis with no guarantee of 
  37. usefulness or correctness of operation for any purpose, intended or
  38. otherwise. The author is in no way liable for this software's performance
  39. or any damage it may cause to any data of any kind anywhere.
  40. ***************************************************************************/
  41. /* These routines based in part on the aliasing facility of MH Version 1.7 */
  42. /* $Log:    alias.c,v $
  43.  * Revision 4.0  86/11/17  16:02:00  sob
  44.  * Release version 4.0 -- uumail
  45.  * 
  46.  * Revision 3.3  86/10/21  15:06:12  sob
  47.  * Added lint #indef to make lint happier
  48.  * 
  49.  * Revision 3.2  86/07/11  17:57:42  sob
  50.  * renamed parse to aliasparse to avoid name conflict with resolve
  51.  * 
  52.  * Revision 3.1  86/05/13  12:36:47  sob
  53.  * Added the ability to escape sensitive characters per suggestion
  54.  * of tp@ndm20.UUCP.
  55.  * 
  56.  * Revision 3.0  86/03/14  12:04:41  sob
  57.  * Release of 3/15/86 --- 3rd Release
  58.  * 
  59.  * Revision 1.10  86/03/14  11:57:13  sob
  60.  * updated copyright
  61.  * 
  62.  * Revision 1.9  86/03/11  11:28:40  sob
  63.  * Added Copyright Notice
  64.  * 
  65.  * Revision 1.8  86/03/03  17:16:39  sob
  66.  * Added fixes provided by desint!geoff.
  67.  * Stan
  68.  * 
  69.  * Revision 1.7  86/02/26  03:07:20  sob
  70.  * This forward method seems to work. It is a bit awkward, but it does seem
  71.  * to work. We will freeze the release here.
  72.  * 
  73.  * Revision 1.6  86/02/24  12:46:31  sob
  74.  * Fixed some problems with .forward. Still not completely correct, but better.
  75.  * Stan
  76.  * 
  77.  * Revision 1.5  86/02/23  23:48:50  sob
  78.  * This version contains the first attempt to make .forwards work.
  79.  * Stan
  80.  * 
  81.  * Revision 1.4  86/02/23  23:01:12  sob
  82.  * This version will correctly make note of programs that can have output
  83.  * of uumail directly piped into (in place of mail or uux).
  84.  * 
  85.  * Revision 1.3  86/02/18  01:56:12  sob
  86.  * MH aliasing facility has been installed. Now comes time to test.
  87.  * Stan
  88.  * 
  89.  * Revision 1.2  86/02/17  18:42:47  sob
  90.  * First update to add linked list of addresses. Real aliasing to be
  91.  * added next.
  92.  * 
  93.  * Revision 1.1  86/02/10  16:54:12  sob
  94.  * Initial revision
  95.  * 
  96.  *
  97.  */
  98. #ifdef NOALIAS
  99. char *
  100. alias()
  101. {
  102.     return;
  103. }
  104. #else
  105. EXTERN struct mailname addrlist;
  106. #define GROUP "/etc/group"
  107. char *termptr;
  108.  
  109.  
  110. /* Conditional free -- perform a free call if the address passed
  111.  * is in free storage;  else NOP
  112.  */
  113.  
  114.  
  115. cndfree(addr)
  116. char *addr;
  117. {
  118.     extern char end;
  119.  
  120.     if(addr >= &end) free(addr);
  121. }
  122.  
  123. uleq(c1, c2)
  124. register char *c1, *c2;
  125. {
  126.     register int c;
  127.  
  128.     while(c = *c1++)
  129.         if((c|040) != (*c2|040))
  130.             return(0);
  131.         else
  132.             c2++;
  133.     return(*c2 == 0);
  134. }
  135. /* modifications to allow quoting of characters that usually indicate
  136.  * address delimiters provided by tp@ndm20.UUCP
  137.  */
  138. char *aliasparse(ptr, buf)
  139. register char *ptr;
  140. char *buf;
  141. {
  142.     register char *cp;
  143.  
  144.     cp = buf;
  145.     while(isspace(*ptr) || *ptr == ',' || *ptr == ':')
  146.         ptr++;
  147.     while(isalnum(*ptr) || *ptr == '/' || *ptr == '-' || *ptr == '.' || *ptr == '!' || *ptr == '@' || *ptr == '%' || *ptr == '\\') {
  148.         if(*ptr == '\\') ptr++;
  149.         if(*ptr != '\0') *cp++ = *ptr++;
  150.     }
  151.     if(cp == buf) {
  152.         switch(*ptr) {
  153.         case '<':
  154.         case '|':
  155.         case '=':
  156.             *cp++ = *ptr++;
  157.         }
  158.     }
  159.     *cp = 0;
  160.     if(cp == buf)
  161.         return 0;
  162.     termptr = ptr;
  163.     return buf;
  164. }
  165. char *
  166. advance(ptr)
  167.     register char *ptr;
  168. {
  169.     return(termptr);
  170. }
  171.  
  172. alias()
  173. {
  174.     register char *cp, *pp;
  175.     register struct mailname *lp;
  176.     char line[256], pbuf[64];
  177.     FILE *a;
  178.  
  179.     if((a = fopen(AliasFile, "r")) == NULL)
  180.         return;
  181.     while(fgets(line, sizeof line, a)) {
  182.         if(line[0] == ';' || line[0] == '\n')   /* Comment Line */
  183.             continue;
  184.         if((pp = aliasparse(line, pbuf)) == NULL) {
  185.         oops:       fprintf(stderr, "Bad alias file %s\n", AliasFile);
  186.             fprintf(stderr, "Line: %s", line);
  187.             exit(EX_OSFILE);
  188.         }
  189.         for(lp = &addrlist; lp->m_next; lp = lp->m_next) {
  190.             if(aleq(lp->m_next->m_name, pp)) {
  191.                 remove(lp);
  192.                 if(!(cp = advance(line)) ||
  193.                    !(pp = aliasparse(cp, pbuf)))
  194.                     goto oops;
  195.                 switch(*pp) {
  196.                 case '<':       /* From file */
  197.                     cp = advance(cp);
  198.                     if((pp = aliasparse(cp, pbuf)) == NULL)
  199.                         goto oops;
  200.                     addfile(pp);
  201.                     break;
  202.                 case '=':       /* UNIX group */
  203.                     cp = advance(cp);
  204.                     if((pp = aliasparse(cp, pbuf)) == NULL)
  205.                         goto oops;
  206.                     addgroup(pp);
  207.                     break;
  208.                    case '|':    /* pipe through a program */
  209.                     cp = advance(cp);
  210.                     if ((pp=aliasparse(cp,pbuf)) == NULL)
  211.                         goto oops;
  212.                     addprgm(pp);
  213.                     break;
  214.                 default:        /* Simple list */
  215.                     for(;;) {
  216.                         insert(pp);
  217.                         if(!(cp = advance(line)) ||
  218.                            !(pp = aliasparse(cp, pbuf)))
  219.                             break;
  220.                     }
  221.                 }
  222.                 break;
  223.             }
  224.         }
  225.     }
  226. }
  227.  
  228.  
  229.  
  230.  
  231.  
  232. addfile(file)
  233.     char *file;
  234. {
  235.     register char *cp, *pp;
  236.     char line[128], pbuf[64];
  237.     FILE *f;
  238. #ifdef DEBUG
  239.     if (Debug >3) printf("addfile(%s)\n", file);          
  240. #endif
  241.     if((f = fopen(file, "r")) == NULL) {
  242.         fprintf(stderr, "Can't open ");
  243.         perror(file);
  244.         exit(EX_OSFILE);
  245.     }
  246.     while(fgets(line, sizeof line, f)) {
  247.         cp = line;
  248.         while(pp = aliasparse(cp, pbuf)) {
  249.             insert(pp);
  250.             cp = advance(cp);
  251.         }
  252.     }
  253.     fclose(f);
  254. }
  255.  
  256. addgroup(group)
  257.     char *group;
  258. {
  259.     register char *cp, *pp;
  260.     int found = 0;
  261.     char line[128], pbuf[64], *rindex();
  262.     FILE *f;
  263. #ifdef DEBUG
  264.     if(Debug>3)printf("addgroup(%s)\n", group);        
  265. #endif
  266.     if((f = fopen(GROUP, "r")) == NULL) {
  267.         fprintf(stderr, "Can't open ");
  268.         perror(GROUP);
  269.         exit(EX_OSFILE);
  270.     }
  271.     while(fgets(line, sizeof line, f)) {
  272.         pp = aliasparse(line, pbuf);
  273.         if(strcmp(pp, group) == 0) {
  274.             cp = rindex(line, ':');
  275.             while(pp = aliasparse(cp, pbuf)) {
  276.                 insert(pp);
  277.                 cp = advance(cp);
  278.             }
  279.             found++;
  280.         }
  281.     }
  282.     if(!found) {
  283.         fprintf(stderr, "Group: %s non-existent\n", group);
  284.         exit(EX_DATAERR);
  285.     }
  286.     fclose(f);
  287. }
  288.  
  289. addprgm(name)
  290. char *name;
  291. {
  292.     register struct mailname *mp;
  293.     char * getcpy();
  294.     for(mp = &addrlist; mp->m_next; mp = mp->m_next)
  295.         if(uleq(name, mp->m_next->m_name))
  296.             return;         /* Don't insert existing name! */
  297.     mp->m_next = (struct mailname *) malloc(sizeof *mp->m_next);
  298.     mp = mp->m_next;
  299.     mp->m_next = 0;
  300.     mp->m_name = getcpy(name);
  301.     mp->m_pipe = 1;
  302. }    
  303. remove(mp)              /* Remove NEXT from argument node! */
  304.     register struct mailname *mp;
  305. {
  306.     register struct mailname *rp;
  307.  
  308.     rp = mp->m_next;
  309.     mp->m_next = rp->m_next;
  310.     cndfree(rp->m_name);
  311.     cndfree(rp);
  312. }
  313. insert(name)
  314.     char *name;
  315. {
  316.     register struct mailname *mp;
  317.     char *getcpy();
  318. #ifdef DEBUG
  319.     if(Debug>3)  printf("insert(%s)\n", name);   
  320. #endif
  321.     for(mp = &addrlist; mp->m_next; mp = mp->m_next)
  322.         if(uleq(name, mp->m_next->m_name))
  323.             return;         /* Don't insert existing name! */
  324.     mp->m_next = (struct mailname *) malloc(sizeof *mp->m_next);
  325.     mp = mp->m_next;
  326.     mp->m_next = 0;
  327.     mp->m_pipe=0;
  328.     mp->m_name = getcpy(name);
  329. }
  330.  
  331. aleq(string, aliasent)
  332.     register char *string, *aliasent;
  333. {
  334.     register int c;
  335.  
  336.     while(c = *string++)
  337.         if(*aliasent == '*')
  338.             return 1;
  339.         else if((c|040) != (*aliasent|040))
  340.             return(0);
  341.         else
  342.             aliasent++;
  343.     return(*aliasent == 0 | *aliasent == '*');
  344. }
  345.  
  346. forward()
  347. {
  348.  
  349.     FILE * fp;
  350.     struct passwd * pwd;
  351.     struct mailname *lp;
  352.     char forwardfile[BUFSIZ];
  353.     extern struct passwd * getpwnam ();
  354.  
  355.     for (lp = addrlist.m_next;lp;lp=lp->m_next){
  356.     if (index(lp->m_name,'!')) continue; /* not local */
  357.     if (index(lp->m_name,'@')) continue; /* ditto */
  358.     if (index(lp->m_name,'%')) continue; /* ditto */
  359.     if (index(lp->m_name,'/')) continue; /* filename */
  360.     if ((pwd = getpwnam(lp->m_name)) == NULL) continue;
  361.     sprintf(forwardfile,"%s/.forward",pwd->pw_dir);
  362.     if((fp=fopen(forwardfile,"r")) != NULL){
  363.             strcpy(lp->m_name,"");
  364.             addfile(forwardfile);
  365.         fclose(fp);
  366.         }
  367.     }
  368. }
  369. #endif
  370.  
  371.  
  372. /* add names to the address list */
  373.  
  374.  
  375. add(name, list)
  376. char *name;
  377. struct mailname *list;
  378. {
  379.     register struct mailname *mp;
  380.     char *getcpy();
  381.  
  382.     for(mp = list; mp->m_next; mp = mp->m_next)
  383.         ;
  384.     mp->m_next = (struct mailname *) malloc(sizeof *mp->m_next);
  385.     mp = mp->m_next;
  386.     mp->m_next = 0;
  387.     mp->m_pipe = 0;
  388.     mp->m_name = getcpy(name);
  389. }
  390.  
  391. char *getcpy(str)
  392. {
  393.     register char *cp;
  394.  
  395.     cp = (char *) malloc(strlen(str) + 1);
  396.     strcpy(cp, str);
  397.     return(cp);
  398. }
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406. !STUFFY!FUNK!
  407. echo Extracting uux.c
  408. cat >uux.c <<'!STUFFY!FUNK!'
  409. /*
  410.  * a "fake" uux to replace the realone to allow uumail to intercept
  411.  * mail at sites that mail not be able to recompile their mailers
  412.  * Called via "uux - system!rmail user" from, normally, /bin/mail.
  413. ***************************************************************************
  414. This work in its current form is Copyright 1986 Stan Barber
  415. with the exception of opath, gethostname and the original getpath which
  416. as far as I know are in the Public Domain. This software may be distributed
  417. freely as long as no profit is made from such distribution and this notice
  418. is reproducted in whole.
  419. ***************************************************************************
  420. This software is provided on an "as is" basis with no guarantee of 
  421. usefulness or correctness of operation for any purpose, intended or
  422. otherwise. The author is in no way liable for this software's performance
  423. or any damage it may cause to any data of any kind anywhere.
  424. ***************************************************************************
  425.  * $Log:    uux.c,v $
  426.  * Revision 4.0  86/11/17  16:02:42  sob
  427.  * Release version 4.0 -- uumail
  428.  * 
  429.  * Revision 3.0  86/03/14  12:05:06  sob
  430.  * Release of 3/15/86 --- 3rd Release
  431.  * 
  432.  * Revision 1.6  86/03/14  11:57:51  sob
  433.  * 
  434.  * 
  435.  * Revision 1.5  86/03/11  11:29:17  sob
  436.  * Added Copyright Notice
  437.  * 
  438.  * Revision 1.4  86/02/17  18:07:48  sob
  439.  * Moved REALUUX and UUMAIL definitions to the makefile
  440.  * 
  441.  * Revision 1.3  86/02/17  17:58:15  sob
  442.  * Small syntax problem
  443.  * 
  444.  * Revision 1.2  86/02/17  17:55:45  sob
  445.  * Corrected to remove parens from destbuf.
  446.  * 
  447.  * Revision 1.1  86/02/17  17:45:10  sob
  448.  * Initial revision
  449.  * 
  450.  *
  451.  */
  452.  
  453. #define _DEFINE
  454.  
  455. #include "uuconf.h"
  456. static char rcsid[] = "$Header: uux.c,v 4.0 86/11/17 16:02:42 sob Exp $";
  457.  
  458. extern FILE *popen();
  459. extern char *index();
  460. extern struct passwd *getpwnam();
  461.  
  462. char sysbuf[BUFSIZ];
  463. char destbuf[BUFSIZ];
  464.  
  465. main(argc, argv)
  466. int argc;
  467. char **argv;
  468. {
  469.     char *command;
  470.     struct passwd *pwd;
  471.     char cmd[BUFSIZ];
  472.     char *system = sysbuf;
  473.     char **psystem = &system;
  474.     FILE *netf;
  475.     int c;
  476.  
  477.     if ((argc != 4) || strcmp("-", argv[1]))  /* look for form 
  478.                             of uux command */
  479.         realuux(argv);    
  480.  
  481.     strcpy(sysbuf, argv[2]);    /* save destination system */
  482.  
  483.     if ((command = index(sysbuf, '!')) == NULL)
  484.         realuux(argv);     
  485.     *command++ = 0;
  486.     if (strcmp("rmail", command))    /* look for rmail in command */
  487.         realuux(argv);        
  488.  
  489.     mystrcpy(destbuf, argv[3]);      /*save destination path */
  490.                     /* but get rid of parens */
  491.     /* become UUCP */
  492.     setpwent();
  493.     pwd = getpwnam("uucp");
  494.     if (pwd == NULL) {
  495.         fprintf(stderr, "Can't suid to \"uucp\" in %s\n", REALUUX);
  496.         exit(1);    /* sigh */
  497.     }
  498.     endpwent();
  499.     setuid(pwd->pw_uid);
  500.  
  501.     /* send the mail to uumail */
  502.     sprintf(cmd, "uumail %s!%s", UUMAIL, sysbuf,destbuf);
  503.     if ((netf = popen(cmd, "w")) == NULL)
  504.         exit(EX_TEMPFAIL);    /* failure */
  505.  
  506.     /* send the actual mail */
  507.     while ((c = getchar()) != EOF)
  508.         putc(c, netf);
  509.     fflush(netf);
  510.     exit (pclose(netf)?1:0);    /* causes mail to do the right thing */
  511. }
  512.  
  513. realuux(argv)
  514. char **argv;
  515. {
  516.     int pid, sts;
  517.  
  518.     /* running suid root.  become us again */
  519.     setuid(getuid());
  520.  
  521.         if ((pid = fork()) == -1) {
  522.                 fprintf(stderr, "uux: can't create proc for %s\n",REALUUX);
  523.                 exit(1);
  524.         }
  525.         if (pid) {
  526.                 while (wait(&sts) != pid) {
  527.                         if (wait(&sts)==-1)
  528.                                 exit(1);
  529.                 }
  530.                 exit(sts?1:0);
  531.         }
  532.     execv(REALUUX, argv);
  533.     fprintf(stderr, "uux: can't exec %s\n",REALUUX);
  534.     exit (1);
  535. }
  536.  
  537. /* remove parens for t and put what's left in s */
  538. mystrcpy(s,t)
  539. char * s, *t;
  540. {
  541.     int x;
  542.     while (x = *t++){
  543.         if ((x == '(') || (x == ')'))
  544.             continue;
  545.         *s++ = x;
  546.     }
  547.     
  548.     *s = x;
  549. }
  550. !STUFFY!FUNK!
  551. echo Extracting rmail.c
  552. cat >rmail.c <<'!STUFFY!FUNK!'
  553. #ifndef lint
  554. static char rcsid[]="$Header: rmail.c,v 4.0 86/11/17 16:02:32 sob Exp $";
  555.  
  556. #endif
  557.  
  558. /*
  559. **  RMAIL -- UUCP mail server.
  560. **
  561. **    This program reads the >From ... remote from ... lines that
  562. **    UUCP is so fond of and turns them into something reasonable.
  563. **    It calls uumail giving it a -f option built from these
  564. **    lines.
  565. ***************************************************************************
  566. This work in its current form is Copyright 1986 Stan Barber
  567. with the exception of opath, gethostname and the original getpath which
  568. as far as I know are in the Public Domain. This software may be distributed
  569. freely as long as no profit is made from such distribution and this notice
  570. is reproducted in whole.
  571. ***************************************************************************
  572. This software is provided on an "as is" basis with no guarantee of 
  573. usefulness or correctness of operation for any purpose, intended or
  574. otherwise. The author is in no way liable for this software's performance
  575. or any damage it may cause to any data of any kind anywhere.
  576. ***************************************************************************
  577. */
  578.  
  579. #define _DEFINE
  580.  
  581. #include "uuconf.h"
  582. extern FILE *popen();
  583. extern char *index();
  584. extern char *rindex();
  585.  
  586. main(argc, argv)
  587.     char **argv;
  588. {
  589.     FILE *out;    /* output to mail handler */
  590.     char lbuf[512];    /* one line of the message */
  591.     char from[512];    /* accumulated path of sender */
  592.     char ufrom[64];    /* user on remote system */
  593.     char sys[64];    /* a system in path */
  594.     char junk[512];    /* scratchpad */
  595.     char cmd[2000];
  596.     register char *cp;
  597.     register char *uf;    /* ptr into ufrom */
  598.     int i;
  599.  
  600. # ifdef DEBUG
  601.     if (argc > 1 && strcmp(argv[1], "-T") == 0)
  602.     {
  603.         Debug = TRUE;
  604.         argc--;
  605.         argv++;
  606.     }
  607. # endif DEBUG
  608.  
  609.     if (argc < 2)
  610.     {
  611.         fprintf(stderr, "Usage: rmail user ...\n");
  612.         exit(EX_USAGE);
  613.     }
  614.  
  615.     (void) strcpy(from, "");
  616.     (void) strcpy(ufrom, "/dev/null");
  617.     uf = NULL;
  618.  
  619.     for (;;)
  620.     {
  621.         (void) fgets(lbuf, sizeof lbuf, stdin);
  622.         if (strncmp(lbuf, "From ", 5) != 0 && strncmp(lbuf, ">From ", 6) != 0)
  623.             break;
  624.         (void) sscanf(lbuf, "%s %s", junk, ufrom);
  625.         cp = lbuf;
  626.         uf = ufrom;
  627.         for (;;)
  628.         {
  629.             cp = index(cp+1, 'r');
  630.             if (cp == NULL)
  631.             {
  632.                 register char *p = rindex(uf, '!');
  633.  
  634.                 if (p != NULL)
  635.                 {
  636.                     *p = '\0';
  637.                     if (uf != NULL) 
  638.                         (void) strcpy(sys, uf);
  639.                     else
  640.                         gethostname(sys,32);
  641.                     uf = p + 1;
  642.                     break;
  643.                 }
  644.                 cp = "remote from somewhere";
  645.             }
  646. #ifdef DEBUG
  647.             if (Debug)
  648.                 printf("cp='%s'\n", cp);
  649. #endif
  650.             if (strncmp(cp, "remote from ", 12)==0)
  651.                 break;
  652.         }
  653.         if (cp != NULL)
  654.             (void) sscanf(cp, "remote from %s", sys);
  655.         (void) strcat(from, sys);
  656.         (void) strcat(from, "!");
  657. #ifdef DEBUG
  658.         if (Debug)
  659.             printf("ufrom='%s', sys='%s', from now '%s'\n", uf, sys, from);
  660. #endif
  661.     }
  662.     if (uf != NULL)
  663.         (void) strcat(from, uf);
  664.  
  665. /*    (void) sprintf(cmd, "exec %s -oMrUUCP -em -f%s", MAILER, from);*/
  666.     if (from[0] == '\0')
  667.         (void) sprintf(cmd, "exec %s", MAILER);
  668.     else
  669.         (void) sprintf(cmd, "exec %s -f%s", MAILER, from);
  670.     while (*++argv != NULL)
  671.     {
  672.         (void) strcat(cmd, " '");
  673.         if (**argv == '(')
  674.             (void) strncat(cmd, *argv + 1, strlen(*argv) - 2);
  675.         else
  676.             (void) strcat(cmd, *argv);
  677.         (void) strcat(cmd, "'");
  678.     }
  679. #ifdef DEBUG
  680.     if (Debug)
  681.         printf("cmd='%s'\n", cmd);
  682. #endif
  683.     out = popen(cmd, "w");
  684.     fputs(lbuf, out);
  685.     while (fgets(lbuf, sizeof lbuf, stdin))
  686.         fputs(lbuf, out);
  687.     i = pclose(out);
  688.     if ((i & 0377) != 0)
  689.     {
  690.         fprintf(stderr, "pclose: status 0%o\n", i);
  691.         exit(EX_OSERR);
  692.     }
  693.  
  694.     exit((i >> 8) & 0377);
  695. }
  696. !STUFFY!FUNK!
  697. echo Extracting uumail.8.SH
  698. cat >uumail.8.SH <<'!STUFFY!FUNK!'
  699. case $CONFIG in
  700.    '') . config.sh ;;
  701. esac
  702. $echo "Extracting uumail.8 (with variable substitutions)"
  703. cat > uumail.8 <<!GROK!THIS!
  704. .RL "Baylor College of Medicine"
  705. .TH UUMAIL 8
  706. .fi
  707. .ad b
  708. .SH NAME
  709. uumail \- rewrite address & route mail using uucpmap database 
  710. .br
  711. uupath \- print the uucp path to a host
  712. .SH SYNOPSIS
  713. .B uumail [ \fIoptions\fR ] \fIaddress\fR
  714. .br
  715. .B uupath \fIhostname\fR
  716. .SH DESCRIPTION
  717. .B Uumail
  718. is designed to be used as a mail delivery program to correctly
  719. route mail over uucp connections.
  720. .SS Standard Options
  721. .IP "-f\fIaddress\fR" 16
  722. The
  723. .I -f
  724. option sets the address of the sender of the mail. If this flag 
  725. is not used, the sender will be established by usings environmental variables
  726. (like 
  727. .B LOGNAME
  728. and
  729. .B USER
  730. ) or using getlogin(3).
  731. .IP "-om" 16
  732. The
  733. .I -om
  734. option causes the mail to also be sent to the sender of the message.
  735. .IP "-oc" 16
  736. The 
  737. .I  -oc
  738. option causes
  739. .B uucico 
  740. to be started immediately after queuing the mail.
  741. The default just queues the mail.
  742. .IP "-N" 16
  743. The -N option stops the use of
  744. .B uuname
  745. to determine neighboring hosts. Only the information in the database
  746. will be used for routing information.
  747. .IP "-h" 16
  748. The -h option causes no From_ line to be added to the beginning of file.
  749. This is useful when uumail is being used as a mailer for sendmail(8).
  750. .SS Compile-time Configurable Options
  751. !GROK!THIS!
  752. if test X$debug = Xdefine
  753. then
  754. cat >>uumail.8 <<!ADD!THIS!
  755. .IP "-d[1-6]" 16
  756. The
  757. .I -d 
  758. option turns on the limited debugging facility built into the
  759. mailer.  In debug mode, the mailer does not actually mail anything, but
  760. tells you what it would do if it did do it. The level of debugging can
  761. be set by following the 
  762. .I -d
  763. flag with a number between 1 and 6.
  764. !ADD!THIS!
  765. fi
  766. cat >>uumail.8 <<!EVEN!MORE!
  767. .IP "-g[A-Z]" 16
  768. If your 
  769. .B uux(1)
  770. supports grading of transactions, the
  771. .I -g 
  772. option can be used to set the
  773. grade of this mail. A grade of \fIC\fR is used by default.
  774. !EVEN!MORE!
  775. if test X$noalias = X
  776. then
  777. cat >>uumail.8 <<!ADD!ALIAS!
  778. .IP "-n" 16
  779. The
  780. .I -n
  781. option will prohibit the use of infomation provided by the system alias
  782. file. Information in users'
  783. .I .forward
  784. files will still be utilized if present.
  785. !ADD!ALIAS!
  786. fi
  787. cat >>uumail.8<<!MORE!STUFF!
  788.  
  789. .SS Arguments
  790. .IP \fIhost!user\fR 16
  791. where host is a system node name on the network and user is the login
  792. name of the addressee.
  793. .IP \fIuser@host.domain\fR
  794. same as above with the addition of a domain specifier like
  795. .B .ARPA, .GOV, .COM, .EDU
  796. etc.
  797. .SH FILES
  798. !MORE!STUFF!
  799. if test Xnoalias = X
  800. then
  801. cat >> uumail.8<<!ADD!MORE!ALIAS!
  802. .IP "$aliases" 20'
  803. System-wide alias file
  804. .IP ".forward" 20
  805. Individual user's mail forwarding file
  806. !ADD!MORE!ALIAS!
  807. fi
  808. cat >>uumail.8 <<!OK!HERE!
  809. .IP "$database{.pag|.dir}" 20
  810. Path file produced by pathalias.
  811. !OK!HERE!
  812. if test X$log = Xdefine
  813. then
  814. cat >>uumail.8<<!ADD!MORE!LOG!
  815. .IP "$logfile" 20
  816. Log of uumail activity.
  817. !ADD!MORE!LOG!
  818. fi
  819. cat >>uumail.8 <<!THE!END!
  820. .SH "SEE ALSO"
  821. pathalias(1), address(1), mh(1), sendmail(8), uux(1), uuname(1)
  822. .br
  823. .B RFC 822 "Standard for the Format of ARPA Internet Text Messages"
  824. .br
  825. .B RFC 976 "UUCP Mail Interchange Format Standard"
  826.  
  827. .SH AUTHORS
  828. .br
  829. Stan Barber, Baylor College of Medicine
  830. .br
  831. Getpath routine by John Donnelly, University of Illinois
  832. .br
  833. Gethostname routine by Peter Honeyman, Princeton
  834. .br
  835. Resolve routine written by the UUCP project
  836. .br
  837. Aliasing scheme borrowed from the MH mail handling system
  838. !THE!END!
  839.  
  840. !STUFFY!FUNK!
  841. echo Extracting address.1.SH
  842. cat >address.1.SH <<'!STUFFY!FUNK!'
  843. case $CONFIG in
  844.    '') . config.sh ;;
  845. esac
  846. $echo "Extracting address.1 (with variable substitutions)"
  847. $rm -f address.1
  848. cat >address.1<<!GROK!THIS!
  849. .RL "Baylor College of Medicine"
  850. .TH ADDRESS 1
  851. .SH NAME
  852. address - display the path generated by \fBuumail\fR for an
  853. RFC822/RFC976-format address.
  854. .SH SYNOPSIS
  855. address rfc-address [ ... ]
  856. .SH DESCRIPTION
  857. This program allows you to check the UUCP mail routing path that will
  858. be generated by the UUCP mailer \fBuumail\fR if you specify an
  859. RFC822/RFC976-format address \fBrfc-address\fR in the ``To:'' field of the mail header.
  860. For each RFC-style address on the command line, \fBaddress\fR echoes the
  861. address to the standard output, followed by a colon, followed by
  862. the UUCP address that will be used to send the message to that address.
  863.  
  864. .SH "ADDRESS FORMAT"
  865. Briefly, the RFC822/RFC976-format address is of the form
  866. .nf
  867. .sp 1
  868.     <localaddress>@<hostname>.<domain>
  869. .sp 1
  870. .fi
  871. where <hostname> is the name of the system you are sending the message
  872. to, <domain> is a modifier for <hostname> identifying the network in
  873. which the address is to be interpreted (EDU, COM, GOV, ORG, NET, etc.);
  874. and <localaddress> is an address string to be interpreted on the host
  875. machine.
  876.  
  877. On our system, the presently
  878. valid <domains>s are EDU, COM, GOV, ORG, NET, UUCP, and ARPA.
  879. Omitting
  880. the <domain> causes the network to default to UUCP.  The <hostname>
  881. should be the name of a remote machine to which the message is
  882. directed; see \fI$database\fR for a list of all
  883. known UUCP hostnames.  It is \fInot\fR necessary to specify a UUCP pathname
  884. when using this format; the pathname is automatically determined for you
  885. and substituted into the address before mailing.  The selected pathname
  886. is determined using the \fBpathalias\fR database, and is supposed
  887. to be optimal, taking into consideration information provided by
  888. each site about how often they send mail out, etc.
  889.  
  890. .SH EXAMPLES
  891. .HP 5
  892. joe
  893. .br
  894. The message is sent to the user ``joe'' on the local system.
  895. .HP 5
  896. joe@ucbvax
  897. .br
  898. The message is sent to joe on the UUCP system named ``ucbvax''; this
  899. address is automatically translated to a proper (and ostensibly
  900. optimal) UUCP path.
  901. .HP 5
  902. joe@ucbvax.UUCP
  903. .br
  904. Same as joe@ucbvax
  905. .HP 5
  906. joe@ucbvax.ARPA
  907. .br
  908. The message is addressed to joe at ucbvax, using the ARPA network.
  909. The message will be routed to the ARPAnet via a UUCP-ARPAnet gateway.
  910. .HP 5
  911. ucbvax!multics.mit.edu!joe
  912. .br
  913. The message is sent to ucbvax, who then uses the address
  914. joe@multics.mit.edu to send the message on to multics.mit.edu via the
  915. ARPAnet.  Since ucbvax is on the arpanet, this address will work correctly
  916. (as long as there is someone named joe on the MIT multics machine).
  917. .HP 5
  918. ucbvax!multics.mit.edu!vanderbilt.mailnet!joe
  919. .br
  920. The message is sent via UUCP to ucbvax, who then sends the message
  921. to multics.mit.edu via the arpanet; multics.mit.edu then sends the message
  922. to joe@vanderbilt via MAILNET.  Since the above machines each have access
  923. to the networks named in the address, this address will work correctly.
  924. .SH FILES
  925. $database - Pathalias database
  926. .SH "SEE ALSO"
  927. uupath(1), uumail(8), pathalias(1)
  928. .br
  929. .B RFC 822 "Standard for the Format of ARPA Internet Text Messages"
  930. .br
  931. .B RFC 976 "UUCP Mail Interchange Format Standard"
  932. .SH AUTHOR
  933. Stan Barber, Baylor College of Medicine
  934. !GROK!THIS!
  935.  
  936. !STUFFY!FUNK!
  937. echo Extracting deadletter.c
  938. cat >deadletter.c <<'!STUFFY!FUNK!'
  939. #ifndef lint
  940. static char rcsid[] = "$Header: deadletter.c,v 4.0 86/11/17 16:02:11 sob Exp $";
  941. #endif
  942. /**************************************************************************
  943. This work in its current form is Copyright 1986 Stan Barber
  944. with the exception of resolve, gethostname and the original getpath which
  945. as far as I know are in the Public Domain. This software may be distributed
  946. freely as long as no profit is made from such distribution and this notice
  947. is reproducted in whole.
  948. ***************************************************************************
  949. This software is provided on an "as is" basis with no guarantee of 
  950. usefulness or correctness of operation for any purpose, intended or
  951. otherwise. The author is in no way liable for this software's performance
  952. or any damage it may cause to any data of any kind anywhere.
  953. ***************************************************************************/
  954. /* attempt to return dead letter */
  955. /* $Log:    deadletter.c,v $
  956.  * Revision 4.0  86/11/17  16:02:11  sob
  957.  * Release version 4.0 -- uumail
  958.  * 
  959.  * Revision 1.2  86/10/21  15:32:50  sob
  960.  * Added RETURNMAIL
  961.  * 
  962.  * Revision 1.1  86/09/04  17:53:44  sob
  963.  * Initial revision
  964.  * 
  965.  *
  966.  */
  967. #include "uuconf.h"
  968. EXTERN char progname[];
  969. char letter[] = "/usr/tmp/.rlXXXXXX";
  970.  
  971. deadletter(retlet, here,reason,host)
  972. FILE *retlet;
  973. char * host;
  974. int here,reason;
  975. {
  976.  
  977.     int i;
  978.     long iop;
  979.     struct tm *bp, *localtime();
  980.     FILE * letf;
  981.     char * date, *asctime();
  982.  
  983.     if(getlogin() != NULL) syserr("Letter failed....returned to sender\n");
  984. #ifdef RETURNMAIL
  985.     /*
  986.      * make a place to create the return letter
  987.      */
  988.     mktemp(letter);
  989.     unlink(letter);
  990.     if((letf = fopen(letter, "w")) == NULL){
  991.         fprintf(stderr, "%s : can't open %s for writing\n", progname,letter);
  992.         exit(EX_CANTCREAT);
  993.     }
  994.     /*
  995.      * Format time
  996.      */
  997.     time(&iop);
  998.     bp = localtime(&iop);
  999.     date = asctime(bp);
  1000.     /* build the return header */
  1001.     fprintf(letf,"From %s!%s %.16s %.4s remote from %s\n",
  1002.         Myname,MAILERDAEMON, date, date+20, Myname);
  1003.     fprintf(letf,"From: %s@%s (UUMAIL ROUTER)\nTo: %s\n",MAILERDAEMON,Myname,from);
  1004.     fprintf(letf,"Subject: Failed Mail\nMessage-Id: <%d.%d.%s@%s>\n\n",
  1005.         getpid(),time(0),MAILERDAEMON,Myname);
  1006. #else
  1007.     letf = stderr;
  1008. #endif
  1009.  
  1010.      fprintf(letf,"Your mail failed to reach its destination because:\n");
  1011.     switch(reason){
  1012.         case EX_NOHOST:
  1013.             fprintf(letf,"The path (%s) cannot be resolved.\n",host);
  1014.             break;
  1015.         case EX_OSERR:
  1016.             fprintf(letf,"An Operating System error occurred while processing your\nmail. Please resend.\n");
  1017.             break;
  1018.         default:
  1019.             fprintf(letf,"An unknown error (code = %d) occured.\n",reason);
  1020.             break;
  1021.         }
  1022. #ifdef RETURNMAIL
  1023.         fprintf(letf,"Your returned mail follows:\n");
  1024.         fprintf(letf,"-------------------------------------------\n");
  1025.         while (fgets(lbuf, sizeof lbuf, retlet))
  1026.             {
  1027.                 fprintf(letf,"\t");
  1028.                 fputs(lbuf, letf);
  1029.             }
  1030.  
  1031.  
  1032.                  /* return the mail */
  1033.  
  1034.         fclose(letf);
  1035.         sprintf(lbuf,"%s %s < %s",MAILER,from,letter);
  1036. #ifdef DEBUG
  1037.         if (Debug)
  1038.             fprintf(stderr,"Command is %s\n",lbuf);
  1039.         else
  1040.         {
  1041. #endif
  1042.             system(lbuf);
  1043.             unlink(letter);
  1044. #ifdef DEBUG
  1045.         }
  1046. #endif
  1047. #endif
  1048. }
  1049.  
  1050. !STUFFY!FUNK!
  1051. echo Extracting Makefile.SH
  1052. cat >Makefile.SH <<'!STUFFY!FUNK!'
  1053. case $CONFIG in
  1054.     '') . config.sh ;;
  1055. esac
  1056. echo "Extracting Makefile (with variable substitutions)"
  1057. cat >Makefile <<!GROK!THIS!
  1058. ####################################################################
  1059. # makefile for uumail & uupath
  1060. # program to integrate with pathalias created uucpmap databases
  1061. # programs originally developed by Jeff Donnelly
  1062. # updated to use pathalias database by Stan Barber
  1063. # $Header: Makefile.SH,v 1.2 86/12/15 13:27:53 sob Exp $
  1064. #***************************************************************************
  1065. # This work in its current form is Copyright 1986 Stan Barber
  1066. # with the exception of resolve, gethostname and the original getpath which
  1067. # as far as I know are in the Public Domain. This software may be distributed
  1068. # freely as long as no profit is made from such distribution and this notice
  1069. # is reproducted in whole.
  1070. # ***************************************************************************
  1071. ###############################################################
  1072. .SUFFIXES: .c,v .h,v
  1073.  
  1074. CC= $cc
  1075.  
  1076. CP= $cp
  1077.  
  1078. RM= $rm
  1079.  
  1080. LIBS= $libdbm $ndirlib
  1081.  
  1082. BINDIR=$bindir
  1083.  
  1084. UUCPDIR=$lib
  1085.  
  1086. MANDIR=$mansrc
  1087.  
  1088. UUMAIL=$(UUCPDIR)/uumail
  1089.  
  1090. REALUUX=/usr/bin/uux
  1091.  
  1092. CFLAGS=-O -DUUMAIL='"$(UUMAIL)"' -DREALUUX='"$(REALUUX)"'
  1093. !GROK!THIS!
  1094. cat >> Makefile <<'!NO!SUBS!'
  1095. SHELL=/bin/sh
  1096.  
  1097. .c,v.c:
  1098.     co -q $*.c
  1099.  
  1100. .h,v.h:
  1101.     co -q $*.h
  1102.  
  1103. all: uumail rmail address uux
  1104.  
  1105. cobj=getpath.o resolve.o
  1106.  
  1107. uobj= uumail.o gethostnam.o alias.o deadletter.o $(cobj)
  1108.  
  1109. robj= rmail.o gethostnam.o
  1110.  
  1111. aobj= address.o $(cobj)
  1112.  
  1113. obj= $(aobj) $(uobj) $(robj)
  1114.  
  1115. uumail: $(uobj)
  1116.     $(CC) $(CFLAGS) $(uobj) -o uumail $(LIBS)
  1117.  
  1118. address:$(aobj)
  1119.     $(CC) $(CFLAGS) $(aobj) -o address $(LIBS)
  1120.  
  1121. rmail: $(robj)
  1122.     $(CC) $(CFLAGS) $(robj) -o rmail $(LIBS)
  1123.  
  1124. install: uumail address palias
  1125.     $(CP) address $(BINDIR)
  1126.     $(CP) uumail $(UUCPDIR)
  1127.     $(CP) uumail.8 $(MANDIR)/man8
  1128.     $(CP) address.1 $(MANDIR)/man1
  1129.     ln $(MANDIR)/man8/uumail.8 $(MANDIR)/man1/uupath.1
  1130.     if [ ! -r $(UUCPDIR)/palias ]; then cp palias $(UUCPDIR); fi
  1131.     @echo "To install rmail in place of the current rmail, type"
  1132.     @echo "make mailer"
  1133.     @echo "To intercept uux commands, you need to be sure"
  1134.     @echo "that you correctly specified REALUUX in makefile"
  1135.     @echo "Then type make fakeuux"
  1136.     ln $(UUCPDIR)/uumail $(BINDIR)/uupath
  1137.  
  1138. mailer: rmail
  1139.     make install
  1140.     $(RM) -rf /bin/rmail
  1141.     $(CP) rmail /bin/rmail
  1142.     
  1143. fakeuux: uux
  1144.     make install
  1145.     $(CP) /usr/bin/uux $(REALUUX)
  1146.     $(CP) uux /usr/bin/uux
  1147.     chmod 6755 /usr/bin/uux
  1148.  
  1149. lint:
  1150.     lint $(CFLAGS) getpath.c uumail.c gethostnam.c resolve.c alias.c
  1151.  
  1152. clean: 
  1153.     $(RM) -f *.o uumail address rmail uux
  1154.  
  1155. doc: uumail.8 address.1
  1156.     nroff -man uumail.8 >uumail.cat; nroff -man address.1 >address.cat
  1157.  
  1158.  
  1159. # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
  1160. $(obj):
  1161.     @ echo "You haven't done a "'"make depend" yet!'; exit 1
  1162. !NO!SUBS!
  1163. $eunicefix Makefile
  1164. !STUFFY!FUNK!
  1165. echo Extracting Alias.Design
  1166. cat >Alias.Design <<'!STUFFY!FUNK!'
  1167. This is the format for the Alias file used in uumail. It is derived from
  1168. the Rand Mail Handler system (MH).
  1169. Stan Barber 05/13/86
  1170. ***************************************************************************
  1171. This work in its current form is Copyright 1986 Stan Barber
  1172. with the exception of resolve, gethostname and the original getpath which
  1173. as far as I know are in the Public Domain. This software may be distributed
  1174. freely as long as no profit is made from such distribution and this notice
  1175. is reproducted in whole.
  1176. ***************************************************************************
  1177.  
  1178. The Alias file for mail delivery is the file
  1179.  
  1180.     /usr/lib/uucp/Aliases
  1181.  
  1182. Each line of the alias file has the format:
  1183.  
  1184. match : alias
  1185.  
  1186. Where:
  1187.  
  1188.     alias       :=  simple-list
  1189.             |   "<" alias-file
  1190.             |   "=" UNIX-group
  1191.             |   "|" program-name
  1192.  
  1193.     simple-list :=  simple-name
  1194.             |   simple-list, simple-name
  1195.  
  1196. Alias-file and program-name are fully qualified UNIX file names.
  1197. UNIX-group is a group name from /etc/group.  A simple-name is a 
  1198. local user login name, including only alphanumerics, `.' and `-'. 
  1199. Throughout this file case is ignored, except for alias-file and
  1200. program-name.
  1201.  
  1202. In match, a trailing * on a name will match anything. (See example
  1203. below.)
  1204.  
  1205. The procedure for mail aliasing is:
  1206.  
  1207. 1) Build a list of all addresses from the message to be
  1208.    delivered, eliminating duplicates.
  1209.  
  1210. 2) For each line in the alias file, compare "match" against all
  1211.    of the existing addresses.  If a match, remove the matched
  1212.    name from the address list, and add each new alias name to the
  1213.    address list if it is not already on the list.
  1214.  
  1215. 3) If output from uumail is to be sent to some other program, the pipe
  1216.    ("|") alias will cause output to be directly sent to that program instead
  1217.    of via mail.
  1218.  
  1219. Since the alias file is read line by line, forward references
  1220. work, but backward references are not recognized, thus, there is
  1221. no recursion.
  1222.  
  1223. E.g.:
  1224.  
  1225. Borden: bruce
  1226. Bruce: bsb
  1227. Wharman: mike
  1228. ASRL: bsb, mike, obrien, giarla
  1229. UNIX-committee: < /usr/people/unix-committee
  1230. System: = sys
  1231. rnews: | /usr/lib/news/recnews
  1232.    ...
  1233.  
  1234. In the "unix-committee" example, the file "/usr/people/unix-
  1235. committee" contains one simple-name, or a list of comma separated
  1236. simple-names.  A new-line will be treated as a blank in this
  1237. file, s.a.
  1238.  
  1239.     foo, fie,
  1240.     fum, fiddle
  1241.  
  1242. In the "system" case, the names from the group "sys" will be used
  1243. as the expanded name list.
  1244.  
  1245. Additional note: If you need to use one of the "special" characters
  1246. in an address (e.g. %@\|) then you can escape it with a blackslash
  1247. (like you would do in csh).
  1248. [This modification provided by tp@ndm20.UUCP.]
  1249.  
  1250. Originally by
  1251. Bruce Borden    October 1979
  1252. !STUFFY!FUNK!
  1253. echo Extracting makedepend.SH
  1254. cat >makedepend.SH <<'!STUFFY!FUNK!'
  1255. case $CONFIG in
  1256.     '') . config.sh ;;
  1257. esac
  1258. echo "Extracting makedepend (with variable substitutions)"
  1259. $spitshell >makedepend <<!GROK!THIS!
  1260. $startsh
  1261. # $Header: makedepend.SH,v 4.3.1.2 85/05/13 15:53:42 lwall Exp $
  1262. #
  1263. # $Log:    makedepend.SH,v $
  1264. # Revision 4.3.1.2  85/05/13  15:53:42  lwall
  1265. # Made cpp look in /usr/local/include too.
  1266. # Revision 4.3.1.1  85/05/10  11:35:10  lwall
  1267. # Branch for patches.
  1268. # Revision 4.3  85/05/01  11:42:26  lwall
  1269. # Baseline for release with 4.3bsd.
  1270.  
  1271. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
  1272.  
  1273. $cat /dev/null >.deptmp
  1274. $rm -f X*.c
  1275. for file in *.c; do
  1276.     filebase=\`basename \$file .c\`
  1277.     $echo "Finding dependencies for \$filebase.o."
  1278.     $sed -n <\$file >X\$file \\
  1279.     -e "/^\${filebase}_init(/q" \\
  1280.     -e '/^#/{' \\
  1281.     -e 's|/\*.*$||' \\
  1282.     -e p \\
  1283.     -e '}'
  1284.     $cpp -I/usr/local/include X\$file | $sed  \\
  1285.     -e '/^# *[0-9]/!d' \\
  1286.     -e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\
  1287.     -e 's|: \./|: |' \\
  1288.     -e 's|: X|: |' | \\
  1289.     $uniq | $sort | $uniq >> .deptmp
  1290. done
  1291.  
  1292. for file in *.SH; do
  1293.     $echo \`basename \$file .SH\`: \$file config.sh \; /bin/sh \$file >> .deptmp
  1294. done
  1295.  
  1296. $sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'
  1297.  
  1298. if $test -s .deptmp; then
  1299.     echo "Updating Makefile..."
  1300.     echo "# If this runs make out of memory, delete /usr/include lines." >>Makefile.new
  1301.     $cat .deptmp >>Makefile.new
  1302. else
  1303.     $echo "You don't seem to have a proper C preprocessor.  Using grep instead."
  1304.     $egrep '^#include ' *.c *.h >.deptmp
  1305.     echo "Updating Makefile..."
  1306.     <.deptmp $sed -n 's|c:#include "\(.*\)".*\$\$|o: \1|p' >> Makefile.new
  1307.     <.deptmp $sed -n 's|c:#include <\(.*\)>.*\$\$|o: /usr/include/\1|p' >> Makefile.new
  1308.     <.deptmp $sed -n 's|h:#include "\(.*\)".*\$\$|h: \1|p' >> Makefile.new
  1309.     <.deptmp $sed -n 's|h:#include <\(.*\)>.*\$\$|h: /usr/include/\1|p' >> Makefile.new
  1310. fi
  1311. $mv Makefile Makefile.old
  1312. $mv Makefile.new Makefile
  1313. $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
  1314. rm .deptmp X*.c
  1315.  
  1316. !GROK!THIS!
  1317. $eunicefix makedepend
  1318. chmod 755 makedepend
  1319. !STUFFY!FUNK!
  1320. echo Extracting ndir.c
  1321. cat >ndir.c <<'!STUFFY!FUNK!'
  1322. /* $Header: ndir.c,v 4.0 86/11/17 16:02:25 sob Exp $
  1323.  *
  1324.  * $Log:    ndir.c,v $
  1325.  * Revision 4.0  86/11/17  16:02:25  sob
  1326.  * Release version 4.0 -- uumail
  1327.  * 
  1328.  * Revision 1.1  86/10/21  15:00:28  sob
  1329.  * Initial revision
  1330.  * 
  1331.  * 
  1332.  */
  1333.  
  1334. #include "uuconf.h"
  1335. #include "ndir.h"
  1336.  
  1337. #ifdef USENDIR
  1338. /*
  1339.  * support for Berkeley directory reading routine on a V7 file system
  1340.  */
  1341.  
  1342. /*
  1343.  * open a directory.
  1344.  */
  1345. DIR *
  1346. opendir(name)
  1347. char *name;
  1348. {
  1349.     register DIR *dirp;
  1350.     register int fd;
  1351.     char * malloc();
  1352.  
  1353.     if ((fd = open(name, 0)) == -1)
  1354.         return NULL;
  1355.     if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
  1356.         close (fd);
  1357.         return NULL;
  1358.     }
  1359.     dirp->dd_fd = fd;
  1360.     dirp->dd_loc = 0;
  1361.     return dirp;
  1362. }
  1363.  
  1364. /*
  1365.  * read an old style directory entry and present it as a new one
  1366.  */
  1367. #ifndef pyr
  1368. #define    ODIRSIZ    14
  1369.  
  1370. struct    olddirect {
  1371.     ino_t    od_ino;
  1372.     char    od_name[ODIRSIZ];
  1373. };
  1374. #else    an Pyramid in the ATT universe
  1375. #define    ODIRSIZ    248
  1376.  
  1377. struct    olddirect {
  1378.     long    od_ino;
  1379.     short    od_fill1, od_fill2;
  1380.     char    od_name[ODIRSIZ];
  1381. };
  1382. #endif
  1383.  
  1384. /*
  1385.  * get next entry in a directory.
  1386.  */
  1387. struct direct *
  1388. readdir(dirp)
  1389. register DIR *dirp;
  1390. {
  1391.     register struct olddirect *dp;
  1392.     static struct direct dir;
  1393.  
  1394.     for (;;) {
  1395.         if (dirp->dd_loc == 0) {
  1396.             dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf,
  1397.                 DIRBLKSIZ);
  1398.             if (dirp->dd_size <= 0)
  1399.                 return NULL;
  1400.         }
  1401.         if (dirp->dd_loc >= dirp->dd_size) {
  1402.             dirp->dd_loc = 0;
  1403.             continue;
  1404.         }
  1405.         dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc);
  1406.         dirp->dd_loc += sizeof(struct olddirect);
  1407.         if (dp->od_ino == 0)
  1408.             continue;
  1409.         dir.d_ino = dp->od_ino;
  1410.         strncpy(dir.d_name, dp->od_name, ODIRSIZ);
  1411.         dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */
  1412.         dir.d_namlen = strlen(dir.d_name);
  1413.         dir.d_reclen = DIRSIZ(&dir);
  1414.         return (&dir);
  1415.     }
  1416. }
  1417.  
  1418. /*
  1419.  * close a directory.
  1420.  */
  1421. void
  1422. closedir(dirp)
  1423. register DIR *dirp;
  1424. {
  1425.     close(dirp->dd_fd);
  1426.     dirp->dd_fd = -1;
  1427.     dirp->dd_loc = 0;
  1428.     free(dirp);
  1429. }
  1430. #endif USENDIR
  1431. !STUFFY!FUNK!
  1432. echo Extracting address.c
  1433. cat >address.c <<'!STUFFY!FUNK!'
  1434. /*
  1435.  * address - run opath to see what a translated RFC822 address will come
  1436.  * out as.
  1437.  *
  1438.  * By E. Roskos 1/16/85
  1439.  * $Log:    address.c,v $
  1440.  * Revision 4.0  86/11/17  16:01:45  sob
  1441.  * Release version 4.0 -- uumail
  1442.  * 
  1443.  * Revision 3.3  86/10/01  15:48:13  sob
  1444.  * removed references to now-defunct CONFIGFILE
  1445.  * 
  1446.  * Revision 3.2  86/07/11  17:57:29  sob
  1447.  * Checkpoint in adaptation for resolve
  1448.  * 
  1449.  * Revision 3.1  86/06/10  16:47:56  sob
  1450.  * uswitch per complaint.
  1451.  * Stan
  1452.  * 
  1453.  * Revision 3.0  86/03/14  12:04:19  sob
  1454.  * Release of 3/15/86 --- 3rd Release
  1455.  * 
  1456.  * Revision 1.4  85/12/26  15:47:45  sob
  1457.  * Added modifications suggested by terry%owl@rand-unix.ARPA
  1458.  * 
  1459.  * Revision 1.3  85/11/24  14:50:01  sob
  1460.  * Added corrections provided by regina!mark
  1461.  * 
  1462.  * Revision 1.2  85/09/16  18:31:53  sob
  1463.  * Added DEBUG flag
  1464.  * 
  1465.  * Revision 1.1  85/09/16  17:50:24  sob
  1466.  * Initial revision
  1467.  * 
  1468.  */
  1469. #define _DEFINE
  1470. #include "uuconf.h"
  1471.  
  1472. static char rcsid[] = "$Header: address.c,v 4.0 86/11/17 16:01:45 sob Exp $";
  1473.  
  1474. EXTERN char *paths;
  1475. char *opath(), *oupath();
  1476. int Debug;
  1477.  
  1478. main(argc,argv)
  1479. int argc;
  1480. char **argv;
  1481. {
  1482. char *p;
  1483. char user[BUFSIZ];
  1484. char domain[BUFSIZ];
  1485. paths = DATABASE;
  1486. handle = ALL;
  1487.     if (argc < 2)
  1488.     {
  1489.         fprintf(stderr,"usage: %s rfcaddress [...]\n",
  1490.             argv[0]);
  1491.         exit(1);
  1492.     }
  1493.  
  1494.     while (--argc)
  1495.     {
  1496.         p = *++argv;
  1497.         if (*p=='-')
  1498.         {
  1499.             switch(*++p)
  1500.             {
  1501.             case 'd': Debug++;
  1502.                       continue;
  1503.             default:  printf("unknown switch: %c\n",*p);
  1504.                   continue;
  1505.             }
  1506.         }
  1507.             resolve(p, user, domain);
  1508.         printf("%s: ",p);
  1509.  
  1510.             if(domain[0] == '\0')
  1511.                     printf("%s\n", user);
  1512.             else if(user[0] == '\0')
  1513.                     printf("%s\n", domain);
  1514.             else
  1515.                     printf("%s!%s\n", user, domain);
  1516.     }
  1517.  
  1518.     exit(0);
  1519. }
  1520. !STUFFY!FUNK!
  1521. echo Extracting SYNOPSIS.txt
  1522. cat >SYNOPSIS.txt <<'!STUFFY!FUNK!'
  1523. I am happy to announe the release of uumail version 4.0, the pathalias
  1524. mailer. uumail is not a user-agent. It is intended to be used as a 
  1525. "back-end" to take the mail from user-agents and correctly route it
  1526. to its destination. Other examples of similiar programs include
  1527. sendmail, delivermail, and MMDF.
  1528.  
  1529. Features of uumail include:
  1530.     o RFC 976 Compliant (UUCP Mail Interface Format Standard)
  1531.     o uses pathalias(1) generated database in either text or dbm(3) format
  1532.     o MH-style aliasing support
  1533.     o sendmail-like .forward processing
  1534.     o can pipe mail output into other programs (e.g. uurec)
  1535.     o can be used under SYSTEM III, SYSTEM V or BSD
  1536.     o rn-like Configuration program for easy installation
  1537.     o returns undeliverable mail
  1538.     o usable as a mailer with sendmail(8)
  1539.     o does not require unix sources to install
  1540.     o dynamically determines uucp neighbors without modification
  1541.               of the pathalias database
  1542.         o functions as uupath(1) to return paths from pathalias(1) database
  1543.         o logging of traffic supported
  1544.         o supports 4.3 BSD UUCP graded transactions
  1545.  
  1546. No other programs are required to use uumail. Pathalias(1) is useful for
  1547. generating a full database, but a full database is not required to make
  1548. uumail useful.
  1549.  
  1550. Bug reports are welcome.
  1551.  
  1552. Stan Barber <sob@soma.bcm.tmc.edu>
  1553. ({cuae2,seismo,rice}!soma!sob)
  1554. Cellular Neurophysiology Laboratory
  1555. Department of Neurology
  1556. Baylor Collge of Medicine
  1557. Houston, Texas 77030
  1558.  
  1559.  
  1560.  
  1561. !STUFFY!FUNK!
  1562. echo Extracting gethostnam.c
  1563. cat >gethostnam.c <<'!STUFFY!FUNK!'
  1564. #ifndef lint
  1565. static char    sccsid[] = "@(#)gethostnam.c    6.1 (down!honey) 85/01/21";
  1566. static char    rcsid[] = "$Header: gethostnam.c,v 6.5 86/10/07 15:14:09 sob Exp $";
  1567. #endif lint
  1568.  
  1569. #ifndef GETHOSTNAME
  1570. #include "uuconf.h"
  1571. #ifdef DOUNAME
  1572. #include <sys/utsname.h>
  1573. #endif
  1574.  
  1575. void
  1576. gethostname(name, len)
  1577. char    *name;
  1578. {
  1579.     FILE    *whoami, *fopen(), *popen();
  1580.     char    *ptr, *index();
  1581. #if defined(DOUNAME) && !defined(SYSTEMNAME)
  1582.     struct utsname utsn;
  1583. #endif
  1584.  
  1585.     *name = '\0';
  1586. #ifndef SYSTEMNAME
  1587. #ifdef DOUNAME
  1588.     if (uname(&utsn) != -1)
  1589.     {
  1590.         strcpy(name,utsn.nodename);
  1591.         len = strlen(name);
  1592.           return;
  1593.     }
  1594. #endif
  1595. #endif
  1596.  
  1597. #ifdef SYSTEMNAME
  1598.     /* try /usr/lib/uucp/SYSTEMNAME */
  1599.     if ((whoami = fopen("/usr/lib/uucp/SYSTEMNAME", "r")) != 0) {
  1600.         (void) fgets(name, len, whoami);
  1601.         (void) fclose(whoami);
  1602.         if ((ptr = index(name, '\n')) != 0)
  1603.             *ptr = '\0';
  1604.     }
  1605.     if (*name)
  1606.         return;
  1607. #endif
  1608.     /* try /usr/include/whoami.h */
  1609.     if ((whoami = fopen("/usr/include/whoami.h", "r")) != 0) {
  1610.         while (!feof(whoami)) {
  1611.             char    buf[100];
  1612.  
  1613.             if (fgets(buf, 100, whoami) == 0)
  1614.                 break;
  1615.             if (sscanf(buf, "#define sysname \"%[^\"]\"", name))
  1616.                 break;
  1617.         }
  1618.         (void) fclose(whoami);
  1619.         if (*name)
  1620.             return;
  1621.     }
  1622.  
  1623.     /* ask uucp */
  1624.     if ((whoami = popen("uuname -l", "r")) != 0) {
  1625.         (void) fgets(name, len, whoami);
  1626.         (void) pclose(whoami);
  1627.         if ((ptr = index(name, '\n')) != 0)
  1628.             *ptr = '\0';
  1629.     }
  1630.     if (*name)
  1631.         return;
  1632.     
  1633.     /* failure */
  1634.     return;
  1635. }
  1636. #endif GETHOSTNAME
  1637.  
  1638. !STUFFY!FUNK!
  1639. echo Extracting Sendmail
  1640. cat >Sendmail <<'!STUFFY!FUNK!'
  1641. ***************************************************************************
  1642. This work in its current form is Copyright 1986 Stan Barber
  1643. with the exception of resolve, gethostname and the original getpath which
  1644. as far as I know are in the Public Domain. This software may be distributed
  1645. freely as long as no profit is made from such distribution and this notice
  1646. is reproducted in whole.
  1647. ***************************************************************************
  1648.  
  1649. You probably don't want uumail to alias things, so be sure you answer that
  1650. question correctly when running Configure. You may not want uumail to
  1651. deal with internet addresses (although it really doen't matter) as well.
  1652.  
  1653. Then edit the mailer definition for uucp in /usr/lib/sendmail.cf
  1654. and change the P=/usr/bin/uux to be P=[where uumail is] (e.g.
  1655. /usr/lib/uucp/uumail).
  1656. Change the A= to A=uumail -h -f$g $h!$u
  1657.  
  1658. This will replace the uux execution with uumail. If you do this exactly, 
  1659. you will only need the pathalias generated database to be present for
  1660. uumail to work correctly.
  1661.  
  1662. There are more things you can do to make sendmail be smarter about
  1663. using uumail, but in general, this is not necessary since uumail
  1664. will return informative messges to sendmail ( and the user) if 
  1665. there is a failure.
  1666.  
  1667. If you would like to share your problems or ideas on interfacing
  1668. sendmail and uumail, I would appreciate hearing them.
  1669.  
  1670. Thanks.
  1671. Stan Barber
  1672. 17 November 1986
  1673.  
  1674.  
  1675. !STUFFY!FUNK!
  1676. echo Extracting ndir.h
  1677. cat >ndir.h <<'!STUFFY!FUNK!'
  1678. /* $Header: ndir.h,v 4.3 85/05/01 11:43:00 lwall Exp $
  1679.  *
  1680.  * $Log:    ndir.h,v $
  1681.  * Revision 4.3  85/05/01  11:43:00  lwall
  1682.  * Baseline for release with 4.3bsd.
  1683.  * 
  1684.  */
  1685.  
  1686. #ifdef LIBNDIR
  1687. #   include <ndir.h>
  1688. #else
  1689. #   ifndef USENDIR
  1690. #    include <sys/dir.h>
  1691. #   else
  1692.  
  1693. #ifndef DEV_BSIZE
  1694. #define    DEV_BSIZE    512
  1695. #endif
  1696. #define DIRBLKSIZ    DEV_BSIZE
  1697. #define    MAXNAMLEN    255
  1698.  
  1699. struct    direct {
  1700.     long    d_ino;            /* inode number of entry */
  1701.     short    d_reclen;        /* length of this record */
  1702.     short    d_namlen;        /* length of string in d_name */
  1703.     char    d_name[MAXNAMLEN + 1];    /* name must be no longer than this */
  1704. };
  1705.  
  1706. /*
  1707.  * The DIRSIZ macro gives the minimum record length which will hold
  1708.  * the directory entry.  This requires the amount of space in struct direct
  1709.  * without the d_name field, plus enough space for the name with a terminating
  1710.  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  1711.  */
  1712. #undef DIRSIZ
  1713. #define DIRSIZ(dp) \
  1714.     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
  1715.  
  1716. /*
  1717.  * Definitions for library routines operating on directories.
  1718.  */
  1719. typedef struct _dirdesc {
  1720.     int    dd_fd;
  1721.     long    dd_loc;
  1722.     long    dd_size;
  1723.     char    dd_buf[DIRBLKSIZ];
  1724. } DIR;
  1725. #ifndef NULL
  1726. #define NULL 0
  1727. #endif
  1728. extern    DIR *opendir();
  1729. extern    struct direct *readdir();
  1730. extern    long telldir();
  1731. extern    void seekdir();
  1732. #define rewinddir(dirp)    seekdir((dirp), (long)0)
  1733. extern    void closedir();
  1734.  
  1735. #   endif
  1736. #endif
  1737. !STUFFY!FUNK!
  1738. echo Extracting kitlists.c
  1739. cat >kitlists.c <<'!STUFFY!FUNK!'
  1740. /* $Header: kitlists.c,v 4.0 86/11/17 16:02:20 sob Exp $
  1741.  *
  1742.  * $Log:    kitlists.c,v $
  1743.  * Revision 4.0  86/11/17  16:02:20  sob
  1744.  * Release version 4.0 -- uumail
  1745.  * 
  1746.  * Revision 1.1  86/10/20  15:05:30  sob
  1747.  * Initial revision
  1748.  * 
  1749.  * Revision 4.3  85/05/01  11:42:08  lwall
  1750.  * Baseline for release with 4.3bsd.
  1751.  * 
  1752.  */
  1753.  
  1754. #include <stdio.h>
  1755.  
  1756. #define MAXKIT 100
  1757. #define MAXKITSIZE 50000
  1758. #define KITOVERHEAD 700
  1759. #define FILEOVERHEAD 80
  1760. #define Nullch    (char *)0
  1761. long tot[MAXKIT];
  1762. FILE *outfp[MAXKIT];    /* of course, not this many file descriptors */
  1763.  
  1764. main(argc,argv)
  1765. int argc;
  1766. char **argv;
  1767. {
  1768.     FILE *inp, *popen();
  1769.     char buf[1024], filnam[128];
  1770.     char *index();
  1771.     register char *s;
  1772.     register int i, newtot;
  1773.     
  1774.     sprintf(buf,"\
  1775. ls -l `awk '{print $1}' <%s'` | awk '{print $9 \" \" $5}' | sort +1nr\
  1776. ", argc > 1 ? argv[1] : "MANIFEST.new");
  1777.     inp = popen(buf,"r");
  1778.  
  1779.     while (fgets(buf,1024,inp) != Nullch) {
  1780.     s = index(buf,' ');
  1781.     *s++ = '\0';
  1782.     for (i=1;
  1783.       (newtot = tot[i] + atol(s) + FILEOVERHEAD) > MAXKITSIZE-KITOVERHEAD;
  1784.       i++) 
  1785.         ;
  1786.     if (!tot[i]) {
  1787.         sprintf(filnam,"kit%d.list",i);
  1788.         outfp[i] = fopen(filnam,"w");
  1789.     }
  1790.     tot[i] = newtot;
  1791.     printf("Adding %s to kit %d giving %d bytes\n",buf,i,newtot);
  1792.     fprintf(outfp[i],"%s\n",buf);
  1793.     }
  1794. }
  1795. !STUFFY!FUNK!
  1796. echo Extracting palias
  1797. cat >palias <<'!STUFFY!FUNK!'
  1798. .RDCF.SDC    rice!cbosgd!sdcrdcf!%s
  1799. .arpa    seismo!%s
  1800. .att    rice!cbosgd!%s
  1801. .att.com    rice!cbosgd!%s
  1802. .au    seismo!munnari!%s
  1803. .bcm.tmc.edu    soma!%s
  1804. .bellcore.com    rice!cbosgd!wb2!bellcore!%s
  1805. .bitnet    seismo!tardis!talcott!%s
  1806. .ca    rice!sun!ubc-vision!%s
  1807. .canada    rice!sun!ubc-vision!%s
  1808. .ccur.uucp    rice!cbosgd!codas!peora!%s
  1809. .cdn    rice!sun!ubc-vision!%s
  1810. .com    seismo!%s
  1811. .csnet    seismo!harvard!%s
  1812. .dec    rice!sun!decwrl!%s
  1813. .dec.com    rice!sun!decwrl!%s
  1814. .dms.oz    seismo!munnari!%s
  1815. .dmt.oz    seismo!munnari!%s
  1816. .edu    seismo!%s
  1817. .gb    seismo!mcvax!ukc!%s
  1818. .gov    seismo!%s
  1819. .il    seismo!mcvax!huji!humus!%s
  1820. .israel    seismo!mcvax!huji!humus!%s
  1821. .jp    seismo!kddlab!%s
  1822. .jpn    seismo!kddlab!%s
  1823. .junet    seismo!kddlab!%s
  1824. .korea    seismo!kaist!%s
  1825. .kr    seismo!kaist!%s
  1826. .mailnet    seismo!harvard!%s
  1827. .net    seismo!%s
  1828. .org    seismo!%s
  1829. .oz    seismo!munnari!%s
  1830. .oz.au    seismo!munnari!%s
  1831. .rice.edu    rice!%s
  1832. .sandiego.ncr.uucp    sdcsvax!ncr-sd!%s
  1833. .su.oz    seismo!munnari!%s
  1834. .toronto.cdn    rice!cbosgd!utcs!%s
  1835. .toronto.csnet    rice!cbosgd!utcs!%s
  1836. .trl.oz    seismo!munnari!%s
  1837. .uk    seismo!mcvax!ukc!%s
  1838. .uq.oz    seismo!munnari!%s
  1839. .us    seismo!%s
  1840. .uucp    rice!cbosgd!%s
  1841. !STUFFY!FUNK!
  1842. echo Extracting Binary.Only
  1843. cat >Binary.Only <<'!STUFFY!FUNK!'
  1844. Unfortunately, you may not be able to alter your mail programs to utilize
  1845. the features of uumail. 
  1846.  
  1847. However, I am providing a method for you to try experimentally. Please
  1848. let me know if it works successfully for you.
  1849.  
  1850. Mail usually works like this----
  1851.  
  1852. mail --->Is it local? -->Yes-->put in mail box
  1853.         |
  1854.         No
  1855.         |
  1856.         --> uux --> uucp to destination machine
  1857.  
  1858. What I am providing is a program that you put in place of uux to 
  1859. call uumail to route the mail for you. Then the map becomes---
  1860.  
  1861. mail --->Is it local? -->Yes-->put in mail box
  1862.         |
  1863.         No
  1864.         |
  1865.         --> fakeuux --> Is it rmail? --> No --> realuux -->uucp
  1866.                     |
  1867.                     Yes
  1868.                     |
  1869.                     --> uumail --> realuux --> uucp
  1870.  
  1871.  
  1872. Basically, you put the old uux in another place and put this fake uux in
  1873. the original location. To try this feature, edit makefile and change the
  1874. definition of REALUUX to match the place you will put your ORIGINAL uux
  1875. program. Then type
  1876. make fakeuux
  1877.  
  1878. Good luck and let me know if it works.
  1879. Stan Barber
  1880. 17 November 1986
  1881. !STUFFY!FUNK!
  1882. echo Extracting makekit
  1883. cat >makekit <<'!STUFFY!FUNK!'
  1884. #!/bin/sh
  1885. # $Header: makekit,v 4.3 85/05/01 11:42:38 lwall Exp $
  1886. #
  1887. # $Log:    makekit,v $
  1888. # Revision 4.3  85/05/01  11:42:38  lwall
  1889. # Baseline for release with 4.3bsd.
  1890.  
  1891. numkits=$#
  1892. for kitlist in $*; do
  1893.     kit=`basename $kitlist .list`
  1894.     kitnum=`expr "$kit" : 'kit\([0-9][0-9]*\)'`
  1895.     echo "*** Making $kit ***"
  1896.     kitleader "$kit" "$kitnum" "$numkits"
  1897.     for file in `/bin/cat $kitlist`; do
  1898.     echo $file
  1899.     echo "echo Extracting $file" >> $kit
  1900.     if egrep '^\.$' $file; then
  1901.         echo "sed >$file <<'!STUFFY!FUNK!' -e 's/X//'" >> $kit
  1902.         sed <$file >>$kit -e 's/^/X/'
  1903.     else
  1904.         echo "cat >$file <<'!STUFFY!FUNK!'" >> $kit
  1905.         /bin/cat $file >> $kit
  1906.     fi
  1907.     echo "!STUFFY!FUNK!" >> $kit
  1908.     done
  1909.     kittrailer "$kit" "$kitnum" "$numkits"
  1910. done
  1911. !STUFFY!FUNK!
  1912. echo Extracting manimake
  1913. cat >manimake <<'!STUFFY!FUNK!'
  1914. #!/bin/sh
  1915. # $Header: manimake,v 4.3 85/05/01 11:42:46 lwall Exp $
  1916. #
  1917. # $Log:    manimake,v $
  1918. # Revision 4.3  85/05/01  11:42:46  lwall
  1919. # Baseline for release with 4.3bsd.
  1920.  
  1921. : make MANIFEST and MANIFEST.new say the same thing
  1922. if test -f MANIFEST.new; then
  1923.     cat <<'EOH' > MANIFEST
  1924. After all the uumail kits are run you should have the following files:
  1925.  
  1926. Filename    Kit Description
  1927. --------    --- -----------
  1928. EOH
  1929.     sort MANIFEST.new >.mani
  1930.     grep . kit*.list | sed 's/^kit\(.*\)\.list:\$*\(.*\)$/\2 |\1|/' | \
  1931.     sort | \
  1932.     join -a1 - .mani | \
  1933.     awk -F'|' '{printf "%-16s%2s %s\n",$1,$2,$3}' | \
  1934.     unexpand >> MANIFEST
  1935.     rm .mani
  1936. else
  1937.     echo "You don't have a MANIFEST.new file.  Run manifake."
  1938. fi
  1939. !STUFFY!FUNK!
  1940. echo Extracting patchlevel.h
  1941. cat >patchlevel.h <<'!STUFFY!FUNK!'
  1942. #define PATCHLEVEL 1
  1943. static char * Version[] = "uumail 4.2 02/02/87";
  1944. !STUFFY!FUNK!
  1945. echo ""
  1946. echo "End of kit 3 (of 4)"
  1947. cat /dev/null >kit3isdone
  1948. config=true
  1949. for iskit in 1               2               3               4               ; do
  1950.     if test -f kit${iskit}isdone; then
  1951.     echo "You have run kit ${iskit}."
  1952.     else
  1953.     echo "You still need to run kit ${iskit}."
  1954.     config=false
  1955.     fi
  1956. done
  1957. case $config in
  1958.     true)
  1959.     echo "You have run all your kits.  Please read README and then type Configure."
  1960.     chmod 755 Configure
  1961.     ;;
  1962. esac
  1963. : I do not append .signature, but someone might mail this.
  1964. exit
  1965.  
  1966.