home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Lib / addr / ap_s2p.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  1.5 KB  |  84 lines

  1. /* ap_s2p.c: convert string into major address parts */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Lib/addr/RCS/ap_s2p.c,v 6.0 1991/12/18 20:21:24 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Lib/addr/RCS/ap_s2p.c,v 6.0 1991/12/18 20:21:24 jpo Rel $
  9.  *
  10.  * $Log: ap_s2p.c,v $
  11.  * Revision 6.0  1991/12/18  20:21:24  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. #include "util.h"
  19. #include "ap_lex.h"
  20. #include "ap.h"
  21.  
  22.  
  23. static char     *s2p_txt;       /* -- hdr_in() passes to alst() -- */
  24.  
  25.  
  26.  
  27.  
  28. /* ---------------------  Static  Routines  ------------------------------- */
  29.  
  30.  
  31. /* -- adrs extracted from component text -- */
  32.  
  33. static int s2p_in()
  34. {
  35.     /* -- nothing to give it -- */
  36.  
  37.     if (s2p_txt == NULLCP)
  38.         return (EOF);
  39.  
  40.     switch (*s2p_txt) {
  41.     case '\0':
  42.     case '\n':
  43.         /* -- end of string, drop on through -- */
  44.         s2p_txt = NULLCP;
  45.         return (0);
  46.     }
  47.  
  48.     return (*(s2p_txt++));
  49. }
  50.  
  51.  
  52.  
  53.  
  54. /* ---------------------  Begin  Routines  -------------------------------- */
  55.  
  56.  
  57. /* -- One of the main uses of this routine is to replace adrparse.c -- */
  58.  
  59.  
  60. char *ap_s2p (str_ptr, tree, group, name, local, domain, route)
  61. char            *str_ptr;
  62. AP_ptr          *tree,
  63.         *group,
  64.         *name,
  65.         *local,
  66.         *domain,
  67.         *route;
  68. {
  69.     s2p_txt = str_ptr;
  70.  
  71.     *tree = ap_pinit (s2p_in);
  72.  
  73.     switch (ap_1adr()) {
  74.     case DONE:
  75.         return ((char *) DONE);
  76.     case OK:
  77.         (void) ap_t2p (*tree, group, name, local, domain, route);
  78.         /* -- so they can parse the next chunk -- */
  79.         return (s2p_txt);
  80.     }
  81.  
  82.     return ((char *) NOTOK);
  83. }
  84.