home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume9 / uumail.pch < prev    next >
Text File  |  1987-04-13  |  26KB  |  1,035 lines

  1. Subject:  v09i048:  UUmail 4.X patch
  2. Newsgroups: mod.sources
  3. Approved: rs@mirror.TMC.COM
  4.  
  5. Submitted by: rice!cortex!sob (Stan Barber)
  6. Mod.sources: Volume 9, Issue 48
  7. Archive-name: uumail.pch
  8.  
  9. [  The version published in Volume 8 of mod.sources had already integrated
  10.    Patch 1.  --r$  ]
  11.  
  12. System: uumail version 4.2
  13. Patch #: 2
  14. Priority: REQUIRED
  15. Subject: General fixes to getpath.c rmail.c uumail.c Configure Makefile.SH
  16. From: smb!dave, atelabs!cds
  17.  
  18. Description:
  19.          Some typos in the declaration of Version and bangpath. The Putfrom
  20.          routine was not rebuilding the From_ line correctly. Configure 
  21.          needed to identify 8086 and z8000 machines for their need for
  22.          seperate I and D. Default log, Alias and paths files are now
  23.          created if the user wants them created. Getpaths calls uuname 
  24.          twice when it only has to call it once. Makefile will not protect
  25.          the naive installed from killing his copy of REALUUX. uumail can
  26.          now double as address as well as uupath.
  27.  
  28. Repeat by:
  29.          Feed uumail a message with lots of From_ lines and see what Putfrom
  30.          does when it rebuilds them. The Configure problems are obvious ones.
  31.          rmail did not make sure that the argv was terminated with NULL.
  32.     
  33. Fix:     Fix the typos. Add the code to fix the problems in Putfrom.
  34.          Replace the code in getpaths to call uuname only once and make
  35.          a linked list. Fix Makefile. Add support for address into uumail.
  36.  
  37.          From rn, say "| patch -d DIR", where DIR is your rn source directory.
  38.          Outside of rn, say "cd DIR; patch <thisarticle".  If you don't have
  39.          the patch program, apply the following by hand, or get patch.
  40.  
  41.  
  42.          Stan Barber
  43.          {shell,rice,soma}!academ!sob
  44.  
  45.  
  46. Index: pathlevel.h
  47. Prereq: 1
  48. *** patchlevel.BAK    Tue Mar 17 13:09:28 1987
  49. --- patchlevel.h    Tue Mar 17 15:38:14 1987
  50. ***************
  51. *** 1,2 ****
  52. ! #define PATCHLEVEL 1
  53. ! static char *Version[] = "uumail 4.2 02/02/87";
  54. --- 1,2 ----
  55. ! #define PATCHLEVEL 2
  56. ! static char  Version[] = "uumail 4.3 03/18/87";
  57.  
  58. Index:Makefile.SH
  59. Prereq: 1.2
  60. *** /tmp/,RCSt1003969    Wed Mar 18 13:58:36 1987
  61. --- /tmp/,RCSt2003969    Wed Mar 18 13:58:37 1987
  62. ***************
  63. *** 8,14 ****
  64.   # program to integrate with pathalias created uucpmap databases
  65.   # programs originally developed by Jeff Donnelly
  66.   # updated to use pathalias database by Stan Barber
  67. ! # $Header: Makefile.SH,v 1.2 86/12/15 13:27:53 sob Exp $
  68.   #***************************************************************************
  69.   # This work in its current form is Copyright 1986 Stan Barber
  70.   # with the exception of resolve, gethostname and the original getpath which
  71. --- 8,14 ----
  72.   # program to integrate with pathalias created uucpmap databases
  73.   # programs originally developed by Jeff Donnelly
  74.   # updated to use pathalias database by Stan Barber
  75. ! # $Header: Makefile.SH,v 1.4 87/03/18 13:58:00 sob Exp $
  76.   #***************************************************************************
  77.   # This work in its current form is Copyright 1986 Stan Barber
  78.   # with the exception of resolve, gethostname and the original getpath which
  79. ***************
  80. *** 49,55 ****
  81.   .h,v.h:
  82.       co -q $*.h
  83.   
  84. ! all: uumail rmail address uux
  85.   
  86.   cobj=getpath.o resolve.o
  87.   
  88. --- 49,55 ----
  89.   .h,v.h:
  90.       co -q $*.h
  91.   
  92. ! all: uumail rmail uux
  93.   
  94.   cobj=getpath.o resolve.o
  95.   
  96. ***************
  97. *** 57,77 ****
  98.   
  99.   robj= rmail.o gethostnam.o
  100.   
  101. ! aobj= address.o $(cobj)
  102.   
  103. ! obj= $(aobj) $(uobj) $(robj)
  104.   
  105.   uumail: $(uobj)
  106.       $(CC) $(CFLAGS) $(uobj) -o uumail $(LIBS)
  107.   
  108. - address:$(aobj)
  109. -     $(CC) $(CFLAGS) $(aobj) -o address $(LIBS)
  110.   rmail: $(robj)
  111.       $(CC) $(CFLAGS) $(robj) -o rmail $(LIBS)
  112.   
  113. ! install: uumail address palias
  114. !     $(CP) address $(BINDIR)
  115.       $(CP) uumail $(UUCPDIR)
  116.       $(CP) uumail.8 $(MANDIR)/man8
  117.       $(CP) address.1 $(MANDIR)/man1
  118. --- 57,77 ----
  119.   
  120.   robj= rmail.o gethostnam.o
  121.   
  122. ! uuxobj= uux.c
  123.   
  124. ! obj= $(uobj) $(robj) $(uuxobj)
  125.   
  126.   uumail: $(uobj)
  127.       $(CC) $(CFLAGS) $(uobj) -o uumail $(LIBS)
  128.   
  129.   rmail: $(robj)
  130.       $(CC) $(CFLAGS) $(robj) -o rmail $(LIBS)
  131.   
  132. ! uux: $(uuxobj)
  133. !     $(CC) $(CFLAGS) $(uuxobj) -o uux $(LIBS)
  134. ! install: uumail palias
  135. !     $(CP) uumail $(BINDIR)/address
  136.       $(CP) uumail $(UUCPDIR)
  137.       $(CP) uumail.8 $(MANDIR)/man8
  138.       $(CP) address.1 $(MANDIR)/man1
  139. ***************
  140. *** 89,99 ****
  141.       $(RM) -rf /bin/rmail
  142.       $(CP) rmail /bin/rmail
  143.       
  144. ! fakeuux: uux
  145.       make install
  146.       $(CP) /usr/bin/uux $(REALUUX)
  147.       $(CP) uux /usr/bin/uux
  148. !     chmod 6755 /usr/bin/uux
  149.   
  150.   lint:
  151.       lint $(CFLAGS) getpath.c uumail.c gethostnam.c resolve.c alias.c
  152. --- 89,102 ----
  153.       $(RM) -rf /bin/rmail
  154.       $(CP) rmail /bin/rmail
  155.       
  156. ! fakeuux: uux /usr/bin/uux
  157.       make install
  158. +     export PATH || exit 1
  159. +     if test -x $(REALUUX); then $(CP) $(REALUUX) $(REALUUX).old; fi
  160.       $(CP) /usr/bin/uux $(REALUUX)
  161.       $(CP) uux /usr/bin/uux
  162. !     chown root /usr/bin/uux
  163. !     chmod 4755 /usr/bin/uux
  164.   
  165.   lint:
  166.       lint $(CFLAGS) getpath.c uumail.c gethostnam.c resolve.c alias.c
  167.  
  168. Index: Configure
  169. Prereq: 1.12
  170. *** /tmp/,RCSt1004039    Wed Mar 18 14:19:52 1987
  171. --- /tmp/,RCSt2004039    Wed Mar 18 14:19:57 1987
  172. ***************
  173. *** 1,11 ****
  174. ! #! /bin/sh
  175.   #
  176.   # If these # comments don't work, trim them.  Don't worry about the other
  177.   # shell scripts, Configure will trim # comments from them for you.
  178.   #
  179. ! # $Header: Configure,v 1.12 87/02/02 15:44:21 sob Exp $
  180.   #
  181.   # $Log:    Configure,v $
  182.   # Revision 1.12  87/02/02  15:44:21  sob
  183.   # Added localflags option
  184.   # 
  185. --- 1,23 ----
  186. ! #!/bin/sh
  187.   #
  188.   # If these # comments don't work, trim them.  Don't worry about the other
  189.   # shell scripts, Configure will trim # comments from them for you.
  190.   #
  191. ! # $Header: Configure,v 1.15 87/03/18 14:18:38 sob Exp $
  192.   #
  193.   # $Log:    Configure,v $
  194. + # Revision 1.15  87/03/18  14:18:38  sob
  195. + # Minor language and appearance things
  196. + # 
  197. + # Revision 1.14  87/03/17  15:49:51  sob
  198. + # More fixes
  199. + # 
  200. + # Revision 1.13  87/03/17  14:49:06  sob
  201. + # Added checks for other seperate i and d processors
  202. + # Added options for creating the Alias and Paths files if 
  203. + # they did not previously exist.
  204. + # Other fixes.
  205. + # 
  206.   # Revision 1.12  87/02/02  15:44:21  sob
  207.   # Added localflags option
  208.   # 
  209. ***************
  210. *** 388,394 ****
  211. --- 400,445 ----
  212.   else
  213.       echo "This doesn't look like a pdp11 to me."
  214.   fi
  215. + : check for i8086
  216. + echo " "
  217. + cat <<'EOT' >i8086.c
  218. + #ifdef i8086
  219. + exit 0
  220. + #else
  221. + exit 1
  222. + #endif
  223. + EOT
  224. + $cpp i8086.c | grep exit >i8086
  225. + chmod 755 i8086
  226. + $eunicefix i8086
  227. + rm i8086.c
  228.   
  229. + if i8086; then
  230. +     echo "This looks like an 8086-based computer to me."
  231. + else
  232. +     echo "This doesn't look like an 8086-based computer to me."
  233. + fi
  234. + : check for z8000
  235. + echo " "
  236. + cat <<'EOT' >z8000.c
  237. + #ifdef z8000
  238. + exit 0
  239. + #else
  240. + exit 1
  241. + #endif
  242. + EOT
  243. + $cpp z8000.c | grep exit >z8000
  244. + chmod 755 z8000
  245. + $eunicefix z8000
  246. + rm z8000.c
  247. + if z8000; then
  248. +     echo "This looks like a z8000-based computer to me."
  249. + else
  250. +     echo "This doesn't look like a z8000-based computer to me."
  251. + fi
  252.   : see if sh knows # comments
  253.   echo " "
  254.   echo "Checking your sh to see if it knows about # comments..."
  255. ***************
  256. *** 803,809 ****
  257.       $echo " "
  258.       case "$libexp" in
  259.       blurfl*) ;;
  260. !     *) $echo "File $libexp not found";;
  261.       esac
  262.       $echo $n "Where is your uumail log file (~name okay)? [$dflt] $c"
  263.       . myread
  264. --- 854,868 ----
  265.       $echo " "
  266.       case "$libexp" in
  267.       blurfl*) ;;
  268. !     *) $echo "File $libexp not found"
  269. !        $echo $n "Shall I create it for you? $c"
  270. !     . myread
  271. !        case "$ans" in
  272. !        y*) $echo $n "OK... I will create it for you... $c"
  273. !           cp /dev/null $libexp
  274. !           $echo "done" ;;
  275. !     esac
  276. !     ;;
  277.       esac
  278.       $echo $n "Where is your uumail log file (~name okay)? [$dflt] $c"
  279.       . myread
  280. ***************
  281. *** 865,871 ****
  282.       $echo " "
  283.       case "$libexp" in
  284.       blurfl*) ;;
  285. !     *) $echo "File $libexp not found";;
  286.       esac
  287.       $echo $n "Where is your uucp map database (~name okay)? [$dflt] $c"
  288.       . myread
  289. --- 924,943 ----
  290.       $echo " "
  291.       case "$libexp" in
  292.       blurfl*) ;;
  293. !     *) $echo "File $libexp not found"
  294. !        $echo $n "Shall I create it for you? $c"
  295. !     . myread
  296. !        case "$ans" in
  297. !        y*) $echo $n "OK... I will create it for you... $c"
  298. !               for i in `cat uucp.local`
  299. !               do
  300. !                    $echo "$i  $i!%s" >> $libexp
  301. !               done
  302. !           $echo "done" ;;
  303. !        *) $echo "OK, you create it and run Configure when you are done."
  304. !           exit 1 ;;
  305. !     esac
  306. !         ;;
  307.       esac
  308.       $echo $n "Where is your uucp map database (~name okay)? [$dflt] $c"
  309.       . myread
  310. ***************
  311. *** 948,954 ****
  312.       $echo " "
  313.       case "$libexp" in
  314.       blurfl*) ;;
  315. !     *) $echo "File $libexp not found";;
  316.       esac
  317.       $echo $n "Where is your aliases file (~name okay)? [$dflt] $c"
  318.       . myread
  319. --- 1020,1036 ----
  320.       $echo " "
  321.       case "$libexp" in
  322.       blurfl*) ;;
  323. !     *) $echo "File $libexp not found"
  324. !        $echo $n "Shall I create it for you? $c"
  325. !     . myread
  326. !        case "$ans" in
  327. !        y*) $echo $n "OK... I will create it for you... $c"
  328. !               $echo "Postmaster: root" > $libexp
  329. !           $echo "done" ;;
  330. !        *) $echo "OK, you create it and run Configure when you are done."
  331. !           exit 1 ;;
  332. !     esac
  333. !         ;;
  334.       esac
  335.       $echo $n "Where is your aliases file (~name okay)? [$dflt] $c"
  336.       . myread
  337. ***************
  338. *** 1221,1227 ****
  339.   
  340.   : see if we should throw a -i into the Makefile
  341.   $echo " "
  342. ! if pdp11; then
  343.       if $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1 ; then
  344.       $echo $n "Your system appears to have separate I and D space.  Is this true? [y] $c"
  345.       . myread
  346. --- 1303,1309 ----
  347.   
  348.   : see if we should throw a -i into the Makefile
  349.   $echo " "
  350. ! if pdp11 || i8086 || z8000; then
  351.       if $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1 ; then
  352.       $echo $n "Your system appears to have separate I and D space.  Is this true? [y] $c"
  353.       . myread
  354. ***************
  355. *** 1239,1245 ****
  356.       esac
  357.       fi
  358.   else
  359. !     $echo "Not a pdp11--assuming no separate I and D."
  360.   fi
  361.   
  362.   : index or strcpy
  363. --- 1321,1327 ----
  364.       esac
  365.       fi
  366.   else
  367. !     $echo "Not a pdp11 or i8086 or z8000 --assuming no separate I and D."
  368.   fi
  369.   
  370.   : index or strcpy
  371. ***************
  372. *** 1882,1886 ****
  373.   case "$ans" in
  374.   y*) makedepend;;
  375.   esac
  376. ! $rm -f  uucp.local myread loc filexp bsd pdp11 v7 usg eunice
  377. ! : end of Configure
  378. --- 1964,1967 ----
  379.   case "$ans" in
  380.   y*) makedepend;;
  381.   esac
  382. ! $rm -f  uucp.local myread loc filexp bsd pdp11 z8000 i8086 v7 usg eunice
  383.  
  384. Index: uumail.c
  385. Prereq: 4.2
  386. *** /tmp/,RCSt1003985    Wed Mar 18 14:00:02 1987
  387. --- /tmp/,RCSt2003985    Wed Mar 18 14:00:07 1987
  388. ***************
  389. *** 20,25 ****
  390. --- 20,34 ----
  391.   or any damage it may cause to any data of any kind anywhere.
  392.   ***************************************************************************
  393.    * $Log:    uumail.c,v $
  394. +  * Revision 4.4  87/03/18  13:53:44  sob
  395. +  * More fixes to Putfrom. Added support for uumail acting as the
  396. +  * address command. Some cleanup of parts of the code.
  397. +  * 
  398. +  * Revision 4.3  87/03/17  14:48:15  sob
  399. +  * Made some minor changes in Putfrom suggest by smail 2.3 posting.
  400. +  * Other bug fixes as well.
  401. +  * Stan
  402. +  * 
  403.    * Revision 4.2  87/02/02  15:43:50  sob
  404.    * Added fix for lost line at the beginning of the message problems
  405.    * 
  406. ***************
  407. *** 206,213 ****
  408. --- 215,224 ----
  409.   
  410.   #include "uuconf.h"
  411.   #include "patchlevel.h"
  412. + #include <time.h>
  413.   
  414.   EXTERN bool uupath;
  415. + EXTERN bool addrcmd;
  416.   extern int      errno;
  417.   extern struct passwd *getpwuid();
  418.   extern FILE    *popen();
  419. ***************
  420. *** 221,227 ****
  421.   extern bool    nghborflag;
  422.   EXTERN char    progname[12];
  423.   EXTERN char  *paths;
  424. ! char * bangpath[BUFSIZ];
  425.   char templet[64];
  426.   struct mailname addrlist;    /* list of addresses */
  427.   int local;
  428. --- 232,238 ----
  429.   extern bool    nghborflag;
  430.   EXTERN char    progname[12];
  431.   EXTERN char  *paths;
  432. ! char bangpath[BUFSIZ];
  433.   char templet[64];
  434.   struct mailname addrlist;    /* list of addresses */
  435.   int local;
  436. ***************
  437. *** 276,283 ****
  438.       if (p++ == NULL)
  439.           p = *av;
  440.       strcpy(progname ,p);
  441. !     if(strcmp(p,"uupath") == 0)
  442.           uupath = TRUE;
  443.       while ((p = *++av) != NULL && p[0] == '-')
  444.       {
  445.           switch (p[1])
  446. --- 287,296 ----
  447.       if (p++ == NULL)
  448.           p = *av;
  449.       strcpy(progname ,p);
  450. !     if(strcmp(p,"uupath") == 0)    /* this is the uupath command */
  451.           uupath = TRUE;
  452. +     if(strcmp(p,"address") == 0)    /* this is the address command */
  453. +         addrcmd = TRUE;
  454.       while ((p = *++av) != NULL && p[0] == '-')
  455.       {
  456.           switch (p[1])
  457. ***************
  458. *** 402,408 ****
  459.   
  460.   /* If this is not uupath, then there must be a letter */
  461.   
  462. ! if (!uupath)
  463.   {    
  464.   #ifdef DEBUG
  465.       if (Debug) (void) printf("Mail from %s\n",from);
  466. --- 415,421 ----
  467.   
  468.   /* If this is not uupath, then there must be a letter */
  469.   
  470. ! if (!uupath && !addrcmd)
  471.   {    
  472.   #ifdef DEBUG
  473.       if (Debug) (void) printf("Mail from %s\n",from);
  474. ***************
  475. *** 494,521 ****
  476.       }
  477.    r = malloc(PATHSIZ);
  478.    strcpy(r,p);
  479. !  if (index(p,'@') != NULL) handle = ALL;
  480.   /* try one */
  481. !     form = resolve(p,path,user);
  482.       if ( (form == LOCAL && path[0] == '\0') 
  483.           || form == ERROR || form == ROUTE || form == DOMAIN){
  484. !         if (user[0] != '\0') strcpy(p,user);
  485.           path[0] = user[0] = '\0';
  486.   /* try two */
  487. !             if (index(p,'@') != NULL) handle = ALL;
  488. !         form = resolve(p,path,user);
  489.       }
  490.   /* we could punt at this point, but let's forward it to a known
  491.      host that might be able to resolve it */
  492.   
  493.   #ifdef KNOWNHOST /* ugly... alternate suggestions welcome */
  494. !     if ( (exitstat || form == ERROR)
  495. !      && (index(r,'@') != NULL || index(r,'!') != NULL) ){
  496. !         strcpy(p,KNOWNHOST);
  497. !         strcat(p,"!");
  498. !         strcat(p,r);
  499.           user[0] = '\0';
  500. !         form = resolve(p,path,user);
  501.       }
  502.   #endif
  503.   
  504. --- 507,534 ----
  505.       }
  506.    r = malloc(PATHSIZ);
  507.    strcpy(r,p);
  508. !  if (index(r,'@') != NULL) handle = ALL;
  509.   /* try one */
  510. !     form = resolve(r,path,user);
  511.       if ( (form == LOCAL && path[0] == '\0') 
  512.           || form == ERROR || form == ROUTE || form == DOMAIN){
  513. !         if (user[0] != '\0') strcpy(r,user);
  514.           path[0] = user[0] = '\0';
  515.   /* try two */
  516. !             if (index(r,'@') != NULL) handle = ALL;
  517. !         form = resolve(r,path,user);
  518.       }
  519.   /* we could punt at this point, but let's forward it to a known
  520.      host that might be able to resolve it */
  521.   
  522.   #ifdef KNOWNHOST /* ugly... alternate suggestions welcome */
  523. !     if ((addrcmd == FALSE) && (((exitstat || form == ERROR)
  524. !      && (index(p,'@') != NULL || index(p,'!') != NULL) ))){
  525. !         strcpy(r,KNOWNHOST);
  526. !         strcat(r,"!");
  527. !         strcat(r,p);
  528.           user[0] = '\0';
  529. !         form = resolve(r,path,user);
  530.       }
  531.   #endif
  532.   
  533. ***************
  534. *** 527,535 ****
  535.       if (exitstat || form == ERROR )
  536.                /* no match in pathalias database */
  537.       {
  538. !         deadletter(tmpf,local,exitstat,p);
  539. !         unlink(templet);
  540. !         exit(exitstat);
  541.       }
  542.      
  543.   
  544. --- 540,555 ----
  545.       if (exitstat || form == ERROR )
  546.                /* no match in pathalias database */
  547.       {
  548. !         if (addrcmd) {
  549. !             fprintf(stderr,"%s cannot be resolved.\n",
  550. !                         lp->m_name);
  551. !             break;
  552. !         } else {
  553. !             deadletter(tmpf,local,exitstat,p);
  554. !             unlink(templet);
  555. !             exit(exitstat); /* this may be the wrong approach */
  556. !         }
  557.       }
  558.      
  559.   
  560. ***************
  561. *** 539,545 ****
  562.           local = 1;
  563.       }
  564.       } /* end of else uupath */
  565. ! #else
  566.       else
  567.       {
  568.              p = index(q,'!');
  569. --- 559,565 ----
  570.           local = 1;
  571.       }
  572.       } /* end of else uupath */
  573. ! #else /* not RESOLVE */
  574.       else
  575.       {
  576.              p = index(q,'!');
  577. ***************
  578. *** 565,576 ****
  579.               }
  580.           }
  581.       }
  582. ! #endif
  583.   
  584.   #ifdef DEBUG
  585.          if(Debug>3)
  586.           (void) fprintf(stderr,
  587. !             "p = %s path = %s user = %s\n",p, path,user);
  588.   #endif
  589.   
  590.       if (uupath)
  591. --- 585,596 ----
  592.               }
  593.           }
  594.       }
  595. ! #endif /* end RESOLVE */
  596.   
  597.   #ifdef DEBUG
  598.          if(Debug>3)
  599.           (void) fprintf(stderr,
  600. !             "address = %s path = %s user = %s\n",p, path,user);
  601.   #endif
  602.   
  603.       if (uupath)
  604. ***************
  605. *** 580,585 ****
  606. --- 600,611 ----
  607.                               lp->m_name,path);
  608.               continue;
  609.           }
  610. +     else if (addrcmd)
  611. +         {
  612. +             (void) printf("Address %s resolves to %s!%s.\n",
  613. +                     lp->m_name, path, user);
  614. +             continue;
  615. +         }
  616.       else
  617.           {
  618.               if (local)
  619. ***************
  620. *** 619,624 ****
  621. --- 645,656 ----
  622.                   }
  623.               }
  624.   pipeout:
  625. +     if(addrcmd)
  626. +     {
  627. +         printf("Address %s pipes output to %s.\n",lp->m_name,cmd);
  628. +         continue;
  629. +     } else {
  630.   #ifdef DEBUG
  631.       if (Debug) (void) fprintf(stderr,"Command is %s\n",cmd);
  632.   #endif
  633. ***************
  634. *** 658,663 ****
  635. --- 690,696 ----
  636.   #ifdef LOG
  637.           maillog(cmd);
  638.   #endif
  639. +         }
  640.          }
  641.       }
  642.   #ifdef DEBUG
  643. ***************
  644. *** 684,691 ****
  645.       char    *asctime();
  646.       struct    tm *bp, *localtime();
  647.       char    *tp, *zp,*c;
  648. !     int    parts,fromflag=0;
  649. !     char     *partv[16];
  650.       char buf[BUFSIZ], addr[PATHSIZ], domain[PATHSIZ], user[NAMESIZ];
  651.       int form;
  652.       extern build();
  653. --- 717,724 ----
  654.       char    *asctime();
  655.       struct    tm *bp, *localtime();
  656.       char    *tp, *zp,*c;
  657. !     int    i,parts,fromflag=0;
  658. !     char     *partv[128];
  659.       char buf[BUFSIZ], addr[PATHSIZ], domain[PATHSIZ], user[NAMESIZ];
  660.       int form;
  661.       extern build();
  662. ***************
  663. *** 745,750 ****
  664. --- 778,811 ----
  665.   */
  666.       if (bangpath[0] == '\0') strcpy(bangpath,from);
  667.   
  668. +     parts = ssplit(bangpath,'!',partv);
  669. + /* null terminate each part of partv */
  670. +         for (i = 0;i < (parts-1);i++){
  671. +         tp = partv[i];
  672. +         if(*tp == '\0') continue;
  673. +         zp = partv[i+1];
  674. +         zp--;
  675. +         *zp = '\0';
  676. +         zp++;
  677. +     }
  678. + /* now eliminate duplicate parts */
  679. +     for (i = 0; i < ( parts - 2) ; i++){
  680. +            tp = partv[i];
  681. +            zp = partv[i+1];
  682. +            if(strcmp(tp,zp) == 0)
  683. +          *tp = '\0';
  684. +     }
  685. +         buf[0] = '\0';
  686. + /* reassemble the line */
  687. +         for ( i = 0;i<(parts-1);i++){
  688. +                 if ((partv[i][0] == '\0') || ((buf[0] == '\0') &&
  689. +                            (strcmp(partv[i],Myname) == 0))) continue;
  690. +                 (void) strcat(buf,partv[i]);
  691. +                 (void) strcat(buf, "!");
  692. +     }
  693. +         (void) strcat(buf,partv[i]);
  694. +         (void) strcpy(bangpath,buf);    /* overwrite old bangpath */
  695.   /*
  696.    * Format time
  697.    */
  698.  
  699. Index: getpath.c
  700. Prereq: 4.0
  701. *** /tmp/,RCSt1004133    Wed Mar 18 14:59:23 1987
  702. --- /tmp/,RCSt2004133    Wed Mar 18 14:59:26 1987
  703. ***************
  704. *** 39,44 ****
  705. --- 39,50 ----
  706.    * modified to rewind path file (if open), rather than open again
  707.    *
  708.    * $Log:    getpath.c,v $
  709. +  * Revision 4.2  87/03/18  13:54:28  sob
  710. +  * Added some fixes to handle domain searches better.
  711. +  * 
  712. +  * Revision 4.1  87/03/17  14:47:44  sob
  713. +  * Replaced old getneighbors with a new version supplied by smb!dave
  714. +  * 
  715.    * Revision 4.0  86/11/17  16:02:15  sob
  716.    * Release version 4.0 -- uumail
  717.    * 
  718. ***************
  719. *** 160,178 ****
  720.   #include <sys/stat.h>
  721.   #endif
  722.   
  723. ! static char rcsid[] = "$Header: getpath.c,v 4.0 86/11/17 16:02:15 sob Exp $";
  724.   extern char * index();
  725.   extern FILE * fopen (), *popen();
  726.   FILE * in;
  727.   bool nghborflag,gotneighbors;
  728. - char **neighbors, *n_array;    /* rct */
  729.   
  730.   int getpath (sysname, pathname, pathfile)
  731.   char   *sysname, *pathname,*pathfile;
  732.   {
  733. !     int indx,x;
  734.       char ACsysname[NAMESIZ];            /* alternate case sysname */
  735.   #ifdef UUDBM
  736.       datum lhs,rhs;
  737.   #else
  738. --- 166,192 ----
  739.   #include <sys/stat.h>
  740.   #endif
  741.   
  742. ! static char rcsid[] = "$Header: getpath.c,v 4.2 87/03/18 13:54:28 sob Exp $";
  743.   extern char * index();
  744. ! extern char * malloc();
  745.   extern FILE * fopen (), *popen();
  746.   FILE * in;
  747.   bool nghborflag,gotneighbors;
  748.   
  749. + struct system {
  750. +     char *s_name;
  751. +     struct system *s_next;
  752. + };
  753. + static struct system head = {NULL, NULL};
  754.   int getpath (sysname, pathname, pathfile)
  755.   char   *sysname, *pathname,*pathfile;
  756.   {
  757. !     int indx,x,t;
  758.       char ACsysname[NAMESIZ];            /* alternate case sysname */
  759. +     struct system *sys = &head;    
  760.   #ifdef UUDBM
  761.       datum lhs,rhs;
  762.   #else
  763. ***************
  764. *** 187,207 ****
  765.       long last;
  766.       static char buf[256];
  767.   #else
  768. !     char    * p, * q, t;
  769.   #endif
  770.   #endif
  771.   
  772.   
  773.   /* build sysname in the alternate case to conform to methods in SMAIL */
  774. !     if (*(sysname) == '.' || isupper(*sysname)) /* a kludge */
  775.           {
  776.               for (x=0;x<strlen(sysname);x++)
  777. !                 ACsysname[x] = tolower(*(sysname+x));
  778.           }
  779.       else
  780.           {
  781.               for (x=0;x<strlen(sysname);x++)
  782. !                 ACsysname[x] = toupper(*(sysname+x));
  783.           }
  784.   
  785.       if (x < NAMESIZ) ACsysname[x] = '\0';
  786. --- 201,226 ----
  787.       long last;
  788.       static char buf[256];
  789.   #else
  790. !     char    * p, * q;
  791.   #endif
  792.   #endif
  793.   
  794.   
  795.   /* build sysname in the alternate case to conform to methods in SMAIL */
  796. !     if ((*(sysname) == '.' && isupper (*(sysname+1))) ||
  797. !                   isupper (*sysname)) /* a kludge */
  798.           {
  799.               for (x=0;x<strlen(sysname);x++)
  800. !                 if (*(sysname+x) != '.') 
  801. !                     ACsysname[x] = tolower(*(sysname+x));
  802. !                 else ACsysname[x] = '.';
  803.           }
  804.       else
  805.           {
  806.               for (x=0;x<strlen(sysname);x++)
  807. !                 if (*(sysname+x) != '.') 
  808. !                     ACsysname[x] = toupper(*(sysname+x));
  809. !                 else ACsysname[x] = '.';
  810.           }
  811.   
  812.       if (x < NAMESIZ) ACsysname[x] = '\0';
  813. ***************
  814. *** 216,229 ****
  815.       if (gotneighbors != TRUE) getneighbors();
  816.       indx = 0;
  817.   /* is it a neighbor? */
  818. !     while(neighbors[indx] != NULL && *(neighbors[indx]) != '\0'){
  819. !         if(!strcmp(sysname, neighbors[indx]) 
  820. !             || !strcmp(ACsysname,neighbors[indx])){
  821. !                 strcpy(pathname, neighbors[indx]);
  822. !                 strcat(pathname, "!%s");
  823.                   return(EX_OK);
  824.               }
  825. !             indx++;
  826.           }
  827.       }
  828.   /* not a neighbor, let's look in the database */
  829. --- 235,249 ----
  830.       if (gotneighbors != TRUE) getneighbors();
  831.       indx = 0;
  832.   /* is it a neighbor? */
  833. ! /* thanks to smb!dave for the suggested revision */
  834. !     while(sys->s_name){
  835. !         if (!strcmp(sysname,sys->s_name)
  836. !            || !strcmp(ACsysname,sys->s_name)){
  837. !             strcpy(pathname,sys->s_name);
  838. !             strcat(pathname,"!%s");
  839.                   return(EX_OK);
  840.               }
  841. !             sys = sys->s_next;
  842.           }
  843.       }
  844.   /* not a neighbor, let's look in the database */
  845. ***************
  846. *** 397,491 ****
  847.   }
  848.   #endif
  849.   
  850. ! getneighbors()
  851. ! {
  852. !     FILE *ppntr;
  853. !     char * ptr;
  854. !     int x = 0;
  855. !     char n_neigh[16], *calloc();    /* rct */
  856. !     int nelem = 0;            /* rct */
  857.   
  858. !     gotneighbors = TRUE;
  859. !     /*
  860. !     *  Let's get the number of neighbors we have.
  861. !     *
  862. !     *  Beginning of added code.    --rct
  863. !     */
  864. !     if((ppntr = popen("uuname | wc -l", "r")) != NULL){
  865. ! #ifdef DEBUG
  866. !         if(Debug > 2)
  867. !             (void)fprintf(stderr, "Starting uuname | wc -l\n");
  868.   #endif
  869.       }
  870. !     else{
  871. !         (void)fprintf(stderr, "Error: popen\(\"uuname | wc -l\"\)\n");
  872. !         exit(1);
  873.       }
  874. !     if((fgets(n_neigh, sizeof(n_neigh), ppntr)) != (char *)0){
  875. !         if((ptr = index(n_neigh, '\n')) != (char *)0)
  876. !             *ptr = '\0';
  877. !     }
  878. !     else{
  879. !         (void)fprintf(stderr, "Error: fgets\(n_neigh\)\n");
  880. !         exit(2);
  881. !     }
  882. ! #ifdef DEBUG
  883. !     if (Debug > 2)
  884. !         (void)fprintf(stderr, "n_neigh = %s\n", n_neigh);
  885. ! #endif
  886. !     (void)pclose(ppntr);
  887. !     /*
  888. !     *  Allocate storage for neighbors based on n_neigh.
  889. !     *  Assumption being made here is that no system has a name
  890. !     *  longer than 14 characters.  If this assumption ever turns
  891. !     *  out to be wrong, lots of other code will break before this
  892. !     *  does!    --rct
  893. !     */
  894. !     nelem = atoi(n_neigh) + 2;
  895. !     if(((neighbors = (char **)calloc((unsigned)nelem,
  896. !         sizeof(char **))) == (char **)0) ||
  897. !         ((n_array = calloc((unsigned)nelem, 15)) == (char *)0)){
  898. !         (void)fprintf(stderr, "Error: getneighbors\(\): calloc\(\)\n");
  899. !         exit(3);
  900. !     }
  901. !     /*
  902. !     *  Set up pointers.
  903. !     */
  904. !     for(x = 0; x < nelem; x++)
  905. !         neighbors[x] = &n_array[x * 15];
  906. !     /*
  907. !     *  Now, let's read them in!
  908. !     *
  909. !     *  End of added code.    --rct
  910. !     */
  911. !     if ((ppntr = popen("uuname", "r")) != NULL) {
  912. ! #ifdef DEBUG
  913. !         if (Debug>2)
  914. !             (void)fprintf(stderr, "Starting uuname\n");
  915. ! #endif
  916. !         x = 0;
  917. !         while((fgets(neighbors[x], 15, ppntr)) != NULL){
  918. !             if ((ptr = index(neighbors[x], '\n')) != NULL)
  919. !                 *ptr = '\0';
  920. ! #ifdef DEBUG
  921. !             if (Debug>4)
  922. !                 (void) fprintf(stderr, "Neighbor # %d: %s\n",
  923. !                     x + 1, neighbors[x]);
  924. ! #endif
  925. !             x++;
  926. !         }    
  927. !         (void) pclose(ppntr);
  928. !     }
  929. !     strcpy(neighbors[x], Myname);
  930.   }
  931.   
  932.   
  933. --- 417,459 ----
  934.   }
  935.   #endif
  936.   
  937. ! /*
  938. !  * The getneighbors subroutine is
  939. !  * Copyright (C) Dave Settle Thorn-EMI Datasolve Mar 1987
  940. !  * You can do anything with this, except sell it for profit, or remove
  941. !  * this copyright notice. {used by permission -- sob}
  942. !  *
  943. !  * read list of direct connections from "uuname"
  944. !  */
  945. ! getneighbors(){
  946. !     char name[32], *p;
  947. !     struct system *sys = &head;
  948. !     FILE *cmd;
  949. !     int i;
  950. ! /*
  951. !  */
  952.   
  953. !     if((cmd = popen("uuname", "r")) == NULL) {
  954. ! #ifdef notdef
  955. !         perror("uuname");
  956. !         return(EX_NOHOST);    /* we don't really care */
  957. ! #else
  958. !         return;
  959.   #endif
  960.       }
  961. !     while(fgets(name, sizeof name, cmd)) {
  962. !         i = strlen(name);
  963. !         name[i - 1] = '\0'; /* chop off newline */
  964. !         p = malloc(i + 1);
  965. !         strcpy(p, name);
  966. !         sys->s_name = p;        /* store system name */
  967. !         sys->s_next = (struct system *) malloc(sizeof (struct system));
  968. !         sys = sys->s_next;
  969. !         sys->s_name = NULL;
  970. !         sys->s_next = (struct system *) 0;
  971.       }
  972. !     gotneighbors = TRUE;
  973. !     pclose(cmd);
  974.   }
  975.   
  976.   
  977. Index: rmail.c
  978. Prereq: 4.0
  979. *** /tmp/,RCSt1003977    Wed Mar 18 13:59:22 1987
  980. --- /tmp/,RCSt2003977    Wed Mar 18 13:59:23 1987
  981. ***************
  982. *** 1,5 ****
  983.   #ifndef lint
  984. ! static char rcsid[]="$Header: rmail.c,v 4.0 86/11/17 16:02:32 sob Exp $";
  985.   
  986.   #endif
  987.   
  988. --- 1,5 ----
  989.   #ifndef lint
  990. ! static char rcsid[]="$Header: rmail.c,v 4.1 87/03/17 15:49:04 sob Exp $";
  991.   
  992.   #endif
  993.   
  994. ***************
  995. *** 44,50 ****
  996.       register char *cp;
  997.       register char *uf;    /* ptr into ufrom */
  998.       int i;
  999.   # ifdef DEBUG
  1000.       if (argc > 1 && strcmp(argv[1], "-T") == 0)
  1001.       {
  1002. --- 44,50 ----
  1003.       register char *cp;
  1004.       register char *uf;    /* ptr into ufrom */
  1005.       int i;
  1006. !         argv[argc] = NULL;
  1007.   # ifdef DEBUG
  1008.       if (argc > 1 && strcmp(argv[1], "-T") == 0)
  1009.       {
  1010.   
  1011.  
  1012.  
  1013.