home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume30 / pcmail2 / patch04 next >
Encoding:
Text File  |  1992-07-06  |  7.0 KB  |  273 lines

  1. Newsgroups: comp.sources.misc
  2. From: wswietse@bs.win.tue.nl (Wietse Venema)
  3. Subject:  v30i102:  pcmail2 - PC-MAIL release 2, Patch04
  4. Message-ID: <1992Jul6.162456.10677@sparky.imd.sterling.com>
  5. X-Md4-Signature: 6c44f746eea3bc7ad9fe476946ad1cfd
  6. Date: Mon, 6 Jul 1992 16:24:56 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: wswietse@bs.win.tue.nl (Wietse Venema)
  10. Posting-number: Volume 30, Issue 102
  11. Archive-name: pcmail2/patch04
  12. Environment: UNIX, MSDOS
  13. Patch-To: pcmail2: Volume 10, Issue 33-44
  14.  
  15. This is the fourth patch for the pc-mail release 2 package that appeared in
  16. comp.sources.misc January 1990. Earlier patches can obtained via anonymous
  17. ftp from the comp.sources.misc archives at ftp.uu.net, or from the author's
  18. machine ftp.win.tue.nl, where updated versions of the MS-DOS binaries can
  19. be found, too (directory /pub/mail/pc-mail-*), including a program that
  20. patches binaries to support COM2.
  21.  
  22. The following four problems are taken care of by this patch:
  23.  
  24. 1 - In send/expect patterns, runs of '-' delimiters would be treated 
  25.     as a single '-'.  This made it impossible to use expect patterns of
  26.     the form:  CONNECT--CONNECT. Thanks to Phil Hughes (fyl@fylz.com)
  27.     for pointing out this problem.
  28.  
  29. 2 - The code that included the original message in a reply was trying
  30.     to be too smart. This caused problems with some compilers. Phil
  31.     Blanchfield (phil@dgbt.doc.ca) found this one.
  32.  
  33.     Wietse Venema
  34.     Eindhoven University of Technology
  35.     The Netherlands
  36.  
  37. *** connect.c-    Mon Jan 22 13:04:12 1990
  38. --- connect.c    Fri Jul  3 17:07:46 1992
  39. ***************
  40. *** 80,88 ****
  41.   /* CREATION DATE
  42.   /*      Fri Mar 27 17:11:12 GMT+1:00 1987
  43.   /* LAST MODIFICATION
  44. ! /*    90/01/22 13:01:26
  45.   /* VERSION/RELEASE
  46. ! /*    2.1
  47.   /*--*/
  48.   
  49.   #include <stdio.h>
  50. --- 80,88 ----
  51.   /* CREATION DATE
  52.   /*      Fri Mar 27 17:11:12 GMT+1:00 1987
  53.   /* LAST MODIFICATION
  54. ! /*    92/07/03 17:07:43
  55.   /* VERSION/RELEASE
  56. ! /*    2.2
  57.   /*--*/
  58.   
  59.   #include <stdio.h>
  60. ***************
  61. *** 146,151 ****
  62. --- 146,152 ----
  63.   public int disconnect()
  64.   {
  65.       conn_send(escape(DISC_SEQUENCE));        /* send disconnect sequence */
  66. +     sleep(1);                    /* let output drain */
  67.       return (0);                    /* always succeeds... */
  68.   }
  69.   
  70. ***************
  71. *** 193,199 ****
  72.        * are specified.
  73.        */
  74.   
  75. !     for (xp = split(&s, "-"); xp; xp = split(&s, "-")) {
  76.   
  77.       debug(4) ("Expecting: %S\nReceiving: ", xp);
  78.   
  79. --- 194,200 ----
  80.        * are specified.
  81.        */
  82.   
  83. !     for (xp = split_ch(&s, '-'); xp; xp = split_ch(&s, '-')) {
  84.   
  85.       debug(4) ("Expecting: %S\nReceiving: ", xp);
  86.   
  87. ***************
  88. *** 214,220 ****
  89.   
  90.       /* try alternative sequence, if specified, else fail */
  91.   
  92. !     if (sp = split(&s, "-")) {
  93.           conn_send(sp);
  94.       } else {
  95.           trap(E_NOLINE, "LOGIN FAILED (at \"%S\")", xp);
  96. --- 215,221 ----
  97.   
  98.       /* try alternative sequence, if specified, else fail */
  99.   
  100. !     if (sp = split_ch(&s, '-')) {
  101.           conn_send(sp);
  102.       } else {
  103.           trap(E_NOLINE, "LOGIN FAILED (at \"%S\")", xp);
  104. *** defs.h-    Mon Jan 22 13:04:12 1990
  105. --- defs.h    Fri Jul  3 17:07:49 1992
  106. ***************
  107. *** 80,85 ****
  108. --- 80,86 ----
  109.   extern char *myrealloc();
  110.   extern char *strcons();
  111.   extern char *split();
  112. + extern char *split_ch();
  113.   extern char **strvec();
  114.   extern char *vecstr();
  115.   
  116. ***************
  117. *** 97,103 ****
  118.   /* CREATION DATE
  119.   /*      Mon Apr  6 16:58:42 GMT+1:00 1987
  120.   /* LAST MODIFICATION
  121. ! /*    90/01/22 13:01:28
  122.   /* VERSION/RELEASE
  123. ! /*    2.1
  124.   /*--*/
  125. --- 98,104 ----
  126.   /* CREATION DATE
  127.   /*      Mon Apr  6 16:58:42 GMT+1:00 1987
  128.   /* LAST MODIFICATION
  129. ! /*    92/07/03 17:07:46
  130.   /* VERSION/RELEASE
  131. ! /*    2.2
  132.   /*--*/
  133. *** reply.c-    Mon Jan 22 13:04:33 1990
  134. --- reply.c    Fri Jul  3 17:07:52 1992
  135. ***************
  136. *** 45,53 ****
  137.   /* CREATION DATE
  138.   /*    Sun Dec 10 15:48:35 MET 1989
  139.   /* LAST MODIFICATION
  140. ! /*    90/01/22 13:02:29
  141.   /* VERSION/RELEASE
  142. ! /*    2.1
  143.   /*--*/
  144.   
  145.   #include <stdio.h>
  146. --- 45,53 ----
  147.   /* CREATION DATE
  148.   /*    Sun Dec 10 15:48:35 MET 1989
  149.   /* LAST MODIFICATION
  150. ! /*    92/07/03 17:07:49
  151.   /* VERSION/RELEASE
  152. ! /*    2.2
  153.   /*--*/
  154.   
  155.   #include <stdio.h>
  156. ***************
  157. *** 186,202 ****
  158. --- 186,206 ----
  159.       char    line[LINE];
  160.       FILE   *in;
  161.   
  162. + #ifdef notdef
  163.       /* Suppress the first line of the message body if it is empty. */
  164. + #endif
  165.   
  166.       if (in = ascopen(original, "r")) {
  167.       while (ascgets(line, sizeof(line), in)) {
  168.           switch (context = ms_parse(context, line)) {
  169.           case MS_BODY:
  170. + #ifdef notdef
  171.           context++;            /* hack */
  172.           if (line[0] == 0)        /* hack */
  173.               break;
  174.           /* FALLTHROUGH */
  175.           case MS_BODY + 1:            /* hack */
  176. + #endif
  177.           fprintf(out, ">%s\n", line);
  178.           break;
  179.           }
  180. *** str.c-    Mon Jan 22 13:04:39 1990
  181. --- str.c    Fri Jul  3 17:07:55 1992
  182. ***************
  183. *** 17,22 ****
  184. --- 17,26 ----
  185.   /*    char **cpp;
  186.   /*    char *sep;
  187.   /*
  188. + /*    char *split_ch(cpp, sep)
  189. + /*    char **cpp;
  190. + /*    char sep;
  191. + /*
  192.   /*    int istrncmp(s1,s2,n)
  193.   /*    char *s1,s2;
  194.   /*    int n;
  195. ***************
  196. *** 48,53 ****
  197. --- 52,62 ----
  198.   /*    can parse only one string at a time. It still modifies its
  199.   /*    arguments, however.
  200.   /*
  201. + /*    split_ch() is like split(), but does not treat runs of delimiter
  202. + /*    characters as one delimiter. Instead of a delimiter set it takes
  203. + /*    one delimiter character. Otherwise, the interface is the same
  204. + /*    as with split().
  205. + /*
  206.   /*    istrcmp() is a case-insensitive version of the strcmp() function.
  207.   /*
  208.   /*    istrncmp() is a case-insensitive version of the strncmp() function.
  209. ***************
  210. *** 83,91 ****
  211.   /* CREATION DATE
  212.   /*    Tue Apr  5 20:59:29 MET 1988
  213.   /* LAST MODIFICATION
  214. ! /*    90/01/22 13:02:43
  215.   /* VERSION/RELEASE
  216. ! /*    2.1
  217.   /*--*/
  218.   
  219.   #include <stdio.h>
  220. --- 92,100 ----
  221.   /* CREATION DATE
  222.   /*    Tue Apr  5 20:59:29 MET 1988
  223.   /* LAST MODIFICATION
  224. ! /*    92/07/03 17:07:52
  225.   /* VERSION/RELEASE
  226. ! /*    2.2
  227.   /*--*/
  228.   
  229.   #include <stdio.h>
  230. ***************
  231. *** 238,243 ****
  232. --- 247,284 ----
  233.       if (start[0] == 0) {
  234.       return (0);                /* no token */
  235.       } else if (end = strpbrk(start, sep)) {    /* look for separator */
  236. +     *end = '\0';                /* nullify */
  237. +     *cpp = end + 1;                /* advance beyond end */
  238. +     return (start);                /* return token */
  239. +     } else {
  240. +     *cpp = start + strlen(start);        /* advance to terminator */
  241. +     return (start);                /* return token */
  242. +     }
  243. + }
  244. + /* split_ch - return next token in *cpp, update cpp */
  245. + public char *split_ch(cpp, sep)
  246. + register char **cpp;
  247. + register char sep;
  248. + {
  249. +     register char *start;
  250. +     char   *end;
  251. +     char   *strchr();
  252. +     /*
  253. +      * Find the beginning of the first token. If none is found, just return a
  254. +      * null value. Otherwise, if there is a separator that follows the token,
  255. +      * nullify it and advance *cpp to the first character after the nullified
  256. +      * separator. If the token is not followed by a separator advance *cpp to
  257. +      * the null byte that follows the token.
  258. +      */
  259. +     start = *cpp;
  260. +     if (start[0] == 0) {
  261. +     return (0);                /* no token */
  262. +     } else if (end = strchr(start, sep)) {    /* look for separator */
  263.       *end = '\0';                /* nullify */
  264.       *cpp = end + 1;                /* advance beyond end */
  265.       return (start);                /* return token */
  266.  
  267. exit 0 # Just in case...
  268.