home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / src / phone / ph_rdmail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-02-01  |  3.7 KB  |  146 lines

  1. #include "util.h"
  2. #include "mmdf.h"
  3. /*
  4.  *     MULTI-CHANNEL MEMO DISTRIBUTION FACILITY  (MMDF)
  5.  *     
  6.  *
  7.  *     Copyright (C) 1979,1980,1981  University of Delaware
  8.  *     
  9.  *     Department of Electrical Engineering
  10.  *     University of Delaware
  11.  *     Newark, Delaware  19711
  12.  *
  13.  *     Phone:  (302) 738-1163
  14.  *     
  15.  *     
  16.  *     This program module was developed as part of the University
  17.  *     of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
  18.  *     
  19.  *     Acquisition, use, and distribution of this module and its listings
  20.  *     are subject restricted to the terms of a license agreement.
  21.  *     Documents describing systems using this module must cite its source.
  22.  *
  23.  *     The above statements must be retained with all copies of this
  24.  *     program and may not be removed without the consent of the
  25.  *     University of Delaware.
  26.  *     
  27.  *
  28.  *     version  -1    David H. Crocker    March   1979
  29.  *     version   0    David H. Crocker    April   1980
  30.  *     version  v7    David H. Crocker    May     1981
  31.  *     version   1    David H. Crocker    October 1981
  32.  *
  33.  */
  34.  
  35. extern struct ll_struct   *logptr;
  36.  
  37. /* **************  (ph_)  PHONE MAIL-READING SUB-MODULE  ************** */
  38.  
  39. LOCVAR short  ph_nadrs;             /* number of addresses this message   */
  40. LOCVAR  long ph_nchrs;            /* number of chars in msg text        */
  41.  
  42. ph_rinit (info, retadr)          /* get initialization info for msg    */
  43. char   *info,              /* where to put general init info     */
  44.        *retadr;              /* where to put return address        */
  45. {
  46.     short     retval;
  47.     int       len;
  48.     char    linebuf[LINESIZE];
  49.     char   *fromptr,
  50.            *toptr;
  51.  
  52. #ifdef DEBUG
  53.     ll_log (logptr, LLOGBTR, "ph_rinit");
  54. #endif
  55.  
  56.     ph_nadrs = 0;
  57.     ph_nchrs = 0L;
  58.  
  59.     retval = ph_rrec (linebuf, &len);
  60.     if (rp_gval (retval) != RP_OK)
  61.     return (retval);
  62.  
  63.     for (fromptr = linebuf, toptr = info;
  64.         *fromptr != '\n' && *fromptr != ';';
  65.         *toptr++ = *fromptr++)
  66.     switch (*fromptr)      /* mailing mode                         */
  67.     {              /* make sure only has ok values         */
  68.         case ' ': 
  69.         case 'A':
  70.         case 'a': 
  71.         case 'M':
  72.         case 'm': 
  73.         case 'S':
  74.         case 's': 
  75.         break;          /* ok to copy to info field             */
  76.  
  77.         default:           /* invalid code                         */
  78.         ll_log (logptr, LLOGFAT,
  79.             "illegal mode value: %c", *fromptr);
  80.         return (RP_NO);
  81.     };
  82.     *toptr = '\0';
  83.  
  84.     for (toptr = retadr, fromptr++;
  85.         !isnull (*fromptr) && *fromptr != '\n';
  86.         *toptr++ = *fromptr++);
  87.     *toptr = '\0';          /* copy return address                */
  88.  
  89.     return (RP_OK);
  90. }
  91. /* */
  92.  
  93. ph_radr (host, adr)              /* get an address spec from remote    */
  94. char   *host,              /* where to stuff name of next host   */
  95.        *adr;              /* where to stuff rest of address     */
  96. {
  97.     short     retval;
  98.     int       len;
  99.  
  100. #ifdef DEBUG
  101.     ll_log (logptr, LLOGBTR, "ph_radr()");
  102. #endif
  103.  
  104.     *host = '\0';          /* no-op this field                   */
  105.  
  106.     retval = ph_rrec (adr, &len);
  107.     if (rp_gval (retval) != RP_OK)
  108.     return (retval);
  109.  
  110.     ph_nadrs++;
  111.  
  112. #ifdef DEBUG
  113.     ll_log (logptr, LLOGFTR, "'%s'", adr);
  114. #endif
  115.  
  116.     return (RP_OK);
  117. }
  118.  
  119. ph_rtxt (buffer, len)            /* read next part of msg text         */
  120. char   *buffer;              /* where to stuff copy of text        */
  121. int     *len;                      /* where to indicate text's length    */
  122. {
  123.     short     retval;
  124.  
  125. #ifdef DEBUG
  126.     ll_log (logptr, LLOGBTR, "ph_rtxt()");
  127. #endif
  128.  
  129.     retval = ph_rstm (buffer, len);
  130.     if (rp_gval (retval) != RP_OK)
  131.     return (retval);
  132.  
  133.     ph_nchrs += (long) *len;
  134.  
  135. #ifdef DEBUG
  136.     ll_log (logptr, LLOGFTR, "'%s'", buffer);
  137. #endif
  138.  
  139.     return (RP_OK);
  140. }
  141.  
  142. ph_rtend ()
  143. {                               /* end of message text */
  144.     return (RP_OK);
  145. }
  146.