home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / mail / delivery / deliver.tz / deliver / dest.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-07  |  3.0 KB  |  81 lines

  1. /* $Header: dest.h,v 2.2 90/02/23 14:16:41 chip Exp $
  2.  *
  3.  * Description of a mail destination and its state.
  4.  *
  5.  * $Log:    dest.h,v $
  6.  * Revision 2.2  90/02/23  14:16:41  chip
  7.  * Support "#!" in delivery files.
  8.  * Support "user|program" and "user?error" from delivery files.
  9.  * Improve debugging and error message formatting.
  10.  * Rearrange code for clarity.
  11.  * 
  12.  * Revision 2.1  89/06/09  12:25:23  network
  13.  * Update RCS revisions.
  14.  * 
  15.  * Revision 1.3  89/06/09  12:23:48  network
  16.  * Baseline for 2.0 release.
  17.  * 
  18.  */
  19.  
  20. /*----------------------------------------------------------------------
  21.  * Destination class.
  22.  */
  23.  
  24. typedef enum {
  25.     CL_USER,                /* User name, no mailbox                */
  26.     CL_MBOX,                /* User name, with mailbox name         */
  27.     CL_PROG,                /* Program to run with message on stdin */
  28.     CL_UUCP                 /* UUCP address (bang path)             */
  29. } DCLASS;
  30.  
  31. /*----------------------------------------------------------------------
  32.  * Destination state.
  33.  */
  34.  
  35. typedef enum {
  36.     ST_WORKING,             /* the "normal" state                   */
  37.     ST_HOLD,                /* on hold during expansion             */
  38.     ST_DONE,                /* all processing complete              */
  39.     ST_ERROR                /* "something is horribly wrong"        */
  40. } DSTATE;
  41.  
  42. /*----------------------------------------------------------------------
  43.  * Types of destination errors.
  44.  */
  45.  
  46. typedef enum {
  47.     E_IVADDR,               /* invalid address string               */
  48.     E_DFONLY,               /* "user:mbox" etc. for delfiles only   */
  49.     E_NSUSER,               /* no such user                         */
  50.     E_NSHOST,               /* no such host (UUCP addresses)        */
  51.     E_CTPERM,               /* no permissions for that context      */
  52.     E_CTLOST,               /* context lost (should never happen)   */
  53.     E_MBOX,                 /* can't write to mailbox               */
  54.     E_PROG,                 /* subprocess exited with non-zero      */
  55.     E_PIPE,                 /* can't pipe to subprocess (incl. uux) */
  56.     E_ERRMSG                /* other user-described error           */
  57. } DERROR;
  58.  
  59. /*----------------------------------------------------------------------
  60.  * Structure describing a mail destination.
  61.  */
  62.  
  63. #define DEST    struct dest
  64. DEST {
  65.     DEST    *d_next;        /* next destination in the chain        */
  66.     DEST    *d_prev;        /* previous destination in the chain    */
  67.     DCLASS  d_class;        /* destination class                    */
  68.     DSTATE  d_state;        /* destination state                    */
  69.     DERROR  d_error;        /* error code (if state is ST_ERROR)    */
  70.     char    *d_errmsg;      /* error message (if error is E_ERRMSG) */
  71.     int     d_dfdone;       /* boolean -- delivery file was run     */
  72.     char    *d_name;        /* context for delivery                 */
  73.     char    *d_param;       /* parameter (mailbox or program name)  */
  74. };
  75.  
  76. /*----------------------------------------------------------------------
  77.  * Action macros.
  78.  */
  79.  
  80. #define dest_err(d,m)   ((d)->d_state = ST_ERROR, (d)->d_error = (m))
  81.