home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume03 / uumail2.fix < prev    next >
Encoding:
Internet Message Format  |  1988-09-11  |  5.6 KB

  1. From: Stan Barber <genrad!neuro1!sob>
  2. Subject: fix to uumail release 2
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 3, Issue 72
  7. Submitted by: Stan Barber <genrad!neuro1!sob>
  8.  
  9.  
  10. Just after I sent out the release to mod.sources, a user reported a bug
  11. that was not fixed. The bug happens when you link uumail to uupath
  12. and do uupath "yourhostname", like for me to enter uupath neuro1
  13. (or uumail -w neuro1). This would produce a core dump.
  14. Here is the fix in diff -c format (suitable for use with "patch").
  15.  
  16. Stan
  17. P.S. Happy new year!
  18.  
  19. *** uumail.old    Thu Dec 26 16:53:42 1985
  20. --- uumail.c    Thu Dec 26 16:53:46 1985
  21. ***************
  22. *** 8,13
  23.    *  to send the mail.
  24.    *  Otherwise it aborts with an error 68 (host unknown)
  25.    * $Log:    uumail.c,v $
  26.    * Revision 2.9  85/12/10  20:36:01  sob
  27.    * Added new return flag from getpath EX_TEMPFAIL to signal that the
  28.    * path database is currently being updated.
  29.  
  30. --- 8,17 -----
  31.    *  to send the mail.
  32.    *  Otherwise it aborts with an error 68 (host unknown)
  33.    * $Log:    uumail.c,v $
  34. +  * Revision 2.10  85/12/26  16:50:23  sob
  35. +  * Added fixes to allow uupath myhostname to work correctly.
  36. +  * Stan
  37. +  * 
  38.    * Revision 2.9  85/12/10  20:36:01  sob
  39.    * Added new return flag from getpath EX_TEMPFAIL to signal that the
  40.    * path database is currently being updated.
  41. ***************
  42. *** 100,106
  43.   char * from;
  44.   
  45.   
  46. ! static char Version[] ="$Header: uumail.c,v 2.9 85/12/10 20:36:01 sob Exp $";
  47.   
  48.   main(argc, argv)
  49.       char **argv;
  50.  
  51. --- 104,110 -----
  52.   char * from;
  53.   
  54.   
  55. ! static char Version[] ="$Header: uumail.c,v 2.10 85/12/26 16:50:23 sob Exp $";
  56.   
  57.   main(argc, argv)
  58.       char **argv;
  59. ***************
  60. *** 310,315
  61.           if (error == EX_TEMPFAIL) fprintf(stderr,"Database %s is being updated\nTry again later.\n",paths);
  62.           exit(EX_NOHOST);
  63.           }
  64.       }
  65.       else 
  66.       if (index(p,'@') == NULL) strcpy(path,oupath(p)); 
  67.  
  68. --- 314,320 -----
  69.           if (error == EX_TEMPFAIL) fprintf(stderr,"Database %s is being updated\nTry again later.\n",paths);
  70.           exit(EX_NOHOST);
  71.           }
  72. +     if (strcmp(path,"%s") == 0) local = 1;
  73.       }
  74.       else 
  75.       {
  76. ***************
  77. *** 312,319
  78.           }
  79.       }
  80.       else 
  81. !     if (index(p,'@') == NULL) strcpy(path,oupath(p)); 
  82. !         else strcpy(path,opath(p));
  83.   
  84.   /* fix string to allow % to be untranslated by printf and 
  85.    * friends 
  86.  
  87. --- 317,325 -----
  88.       if (strcmp(path,"%s") == 0) local = 1;
  89.       }
  90.       else 
  91. !     {
  92. !     if (index(p,'@') == NULL) strcpy(path,oupath(p)); 
  93. !             else strcpy(path,opath(p));
  94.   
  95.   /* fix string to allow % to be untranslated by printf and 
  96.    * friends 
  97. ***************
  98. *** 318,330
  99.   /* fix string to allow % to be untranslated by printf and 
  100.    * friends 
  101.    */
  102. !    if ((r=index(path,'%')) != NULL)
  103. !     {
  104. !         char t[PATHSIZ];
  105. !         strncpy(t,path,(r-path));
  106. !         strcat(t,"%");
  107. !         strcat(t,r);
  108. !         path = &t[0];
  109.   #ifdef DEBUG
  110.       if (Debug>3)
  111.           fprintf(stderr,"In percent fix, %s\n",t);
  112.  
  113. --- 324,336 -----
  114.   /* fix string to allow % to be untranslated by printf and 
  115.    * friends 
  116.    */
  117. !        if ((r=index(path,'%')) != NULL)
  118. !         {
  119. !             char t[PATHSIZ];
  120. !             strncpy(t,path,(r-path));
  121. !             strcat(t,"%");
  122. !             strcat(t,r);
  123. !             path = &t[0];
  124.   #ifdef DEBUG
  125.           if (Debug>3)
  126.               fprintf(stderr,"In percent fix, %s\n",t);
  127. ***************
  128. *** 326,333
  129.           strcat(t,r);
  130.           path = &t[0];
  131.   #ifdef DEBUG
  132. !     if (Debug>3)
  133. !         fprintf(stderr,"In percent fix, %s\n",t);
  134.   #endif
  135.       }
  136.   
  137.  
  138. --- 332,339 -----
  139.               strcat(t,r);
  140.               path = &t[0];
  141.   #ifdef DEBUG
  142. !         if (Debug>3)
  143. !             fprintf(stderr,"In percent fix, %s\n",t);
  144.   #endif
  145.           }
  146.   
  147. ***************
  148. *** 329,335
  149.       if (Debug>3)
  150.           fprintf(stderr,"In percent fix, %s\n",t);
  151.   #endif
  152. !     }
  153.   
  154.   
  155.   
  156.  
  157. --- 335,341 -----
  158.           if (Debug>3)
  159.               fprintf(stderr,"In percent fix, %s\n",t);
  160.   #endif
  161. !         }
  162.   
  163.   
  164.   
  165. ***************
  166. *** 338,344
  167.       if (Debug >1) fprintf(stderr,"Opath returns %s\n",path);
  168.   #endif
  169.   
  170. !     if (path[0] == '!')  /* no match in pathalias database */
  171.       {
  172.           deadletter(tmpf,local);
  173.           unlink(templet);
  174.  
  175. --- 344,350 -----
  176.       if (Debug >1) fprintf(stderr,"Opath returns %s\n",path);
  177.   #endif
  178.   
  179. !     if (path[0] == '!') /* no match in pathalias database */
  180.       {
  181.           deadletter(tmpf,local);
  182.           unlink(templet);
  183. ***************
  184. *** 345,351
  185.           exit(EX_NOHOST);
  186.       }
  187.      
  188. !    if (strcmp(path,p) == 0)
  189.       {
  190.       strcpy(path,Myname);
  191.       local = 1;
  192.  
  193. --- 351,357 -----
  194.           exit(EX_NOHOST);
  195.       }
  196.      
  197. !    if (strcmp(path,p) == 0 )
  198.       {
  199.       strcpy(path,Myname);
  200.       local = 1;
  201. ***************
  202. *** 350,356
  203.       strcpy(path,Myname);
  204.       local = 1;
  205.       }
  206.   #else
  207.       }
  208.       else
  209.  
  210. --- 356,362 -----
  211.       strcpy(path,Myname);
  212.       local = 1;
  213.       }
  214. !     } /* else uupath */
  215.   #else
  216.       }
  217.       else
  218. ***************
  219. *** 369,378
  220.   
  221.               }
  222.       /* insert code here to look at uucp neighbors & local host */
  223. -     if (bangcnt == 0) {
  224. -             strcpy(sysname,Myname);
  225. -             local = 1;
  226. -             }
  227.       }
  228.   #ifdef DEBUG
  229.       if (Debug>1) printf("sysname = %s\n",&name[0]);
  230.  
  231. --- 375,380 -----
  232.   
  233.               }
  234.       /* insert code here to look at uucp neighbors & local host */
  235.       }
  236.   if (bangcnt == 0) {
  237.           strcpy(sysname,Myname);
  238. ***************
  239. *** 374,379
  240.               local = 1;
  241.               }
  242.       }
  243.   #ifdef DEBUG
  244.       if (Debug>1) printf("sysname = %s\n",&name[0]);
  245.   #endif
  246.  
  247. --- 376,385 -----
  248.               }
  249.       /* insert code here to look at uucp neighbors & local host */
  250.       }
  251. + if (bangcnt == 0) {
  252. +         strcpy(sysname,Myname);
  253. +         local = 1;
  254. +         }
  255.   #ifdef DEBUG
  256.       if (Debug>1) printf("sysname = %s\n",&name[0]);
  257.   #endif
  258. ***************
  259. *** 386,392
  260.           exit(EX_NOHOST);
  261.           }
  262.   
  263. !        if (local) path = sysname;
  264.   #endif
  265.   
  266.   
  267.  
  268. --- 392,399 -----
  269.           exit(EX_NOHOST);
  270.           }
  271.   
  272. !        if (local) path = "%s";
  273. !        if (strcmp (path,"%s") == 0) local = 1;
  274.   #endif
  275.   
  276.   
  277.  
  278.