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

  1. /* ap_t2s.c: Address tree to String */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Lib/addr/RCS/ap_t2s.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_t2s.c,v 6.0 1991/12/18 20:21:24 jpo Rel $
  9.  *
  10.  * $Log: ap_t2s.c,v $
  11.  * Revision 6.0  1991/12/18  20:21:24  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. /*
  19. Format one address from parse tree, into a string
  20.  
  21.     Returns:    pointer to next node, after address
  22.          0 if end of tree
  23.         NOTOK if error
  24. */
  25.  
  26.  
  27. #include "util.h"
  28. #include "ap.h"
  29.  
  30.  
  31.  
  32.  
  33. /* ---------------------  Begin  Routines  -------------------------------- */
  34.  
  35.  
  36. AP_ptr ap_t2s (thetree, str_pptr)
  37. AP_ptr          thetree;        /* -- the parse tree -- */
  38. char            **str_pptr;     /* -- where to stuff the string -- */
  39. {
  40.     AP_ptr  loc_ptr,        /* -- in case fake personal name needed -- */
  41.         group_ptr,
  42.         name_ptr,
  43.         dom_ptr,
  44.         route_ptr,
  45.         return_tree;
  46.  
  47.     return_tree = ap_t2p (thetree, &group_ptr, &name_ptr,
  48.                   &loc_ptr, &dom_ptr, &route_ptr);
  49.  
  50.     if (return_tree == BADAP) {
  51.         PP_LOG (LLOG_EXCEPTIONS,
  52.                 ("Lib/addr/ap_t2s: error from ap_t2p()"));
  53.         *str_pptr = strdup ("(PP Error!)");
  54.         return (BADAP);
  55.     }
  56.  
  57.     *str_pptr = ap_p2s (group_ptr, name_ptr, loc_ptr, dom_ptr, route_ptr);
  58.  
  59.     if (*str_pptr == (char *)NOTOK) {
  60.         PP_LOG (LLOG_EXCEPTIONS,
  61.                 ("Lib/addr/ap_t2s: error from ap_p2s()"));
  62.         *str_pptr = strdup ("(PP Error!)");
  63.         return (BADAP);
  64.     }
  65.  
  66.     return (return_tree);
  67. }
  68.