home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume6 / elm / part04 / hdrs / defs.h < prev    next >
C/C++ Source or Header  |  1986-11-30  |  7KB  |  210 lines

  1. /**        defs.h            **/
  2.  
  3. /**  define file for ELM mail system.  **/
  4.  
  5. /**  (C) Copyright 1985 Dave Taylor    **/
  6.  
  7. #include "sysdefs.h"    /* system/configurable defines */
  8.  
  9. #define VERSION        "1.1" /* Version number!  WHAT_STRING should agree */
  10.  
  11. #define WHAT_STRING    "@(#) Version 1.1, initial release - June 1986"
  12.  
  13. #define SLEN        256        /* long for ensuring no overwrites... */
  14. #define SHORT        5        /* super short strings!          */
  15. #define NLEN        20        /* name length for aliases            */
  16. #define SHORT_SLEN      40
  17. #define STRING        100    /* reasonable string length for most..      */
  18. #define LONG_SLEN    250    /* for mail addresses from remote machines! */
  19. #define LONG_STRING    500    /* even longer string for group expansion   */
  20. #define VERY_LONG_STRING 2500    /* huge string for group alias expansion    */
  21.  
  22. #define BREAK        (char)  0    /* default interrupt    */
  23. #define BACKSPACE    (char)  8    /* backspace character  */
  24. #define TAB        (char)  9       /* tab character        */
  25. #define RETURN        (char) 13    /* carriage return char */
  26. #define LINE_FEED    (char) 10    /* line feed character  */
  27. #define FORMFEED    (char) 12    /* form feed (^L) char  */
  28. #define COMMA        ','        /* comma character      */
  29. #define SPACE        ' '        /* space character      */
  30. #define DOT        '.'        /* period/dot character */
  31. #define BANG        '!'        /* exclaimation mark!   */
  32. #define AT_SIGN        '@'        /* at-sign character    */
  33. #define PERCENT        '%'        /* percent sign char.   */
  34. #define COLON        ':'        /* the colon ..        */
  35. #define ESCAPE        (char) 27    /* the escape        */
  36. #define NO_OP_COMMAND    '\0'        /* no-op for timeouts   */
  37.  
  38. #define STANDARD_INPUT  0        /* file number of stdin */
  39.  
  40. #ifndef TRUE
  41. #define TRUE        1
  42. #define FALSE        0
  43. #endif
  44.  
  45. #define OUTGOING    0        /* defines for lock file   */
  46. #define INCOMING    1        /* creation..see lock()    */
  47.  
  48. #define SH        0        /* defines for system_call */
  49. #define USER_SHELL    1        /* to work correctly!      */
  50.  
  51. #define EXECUTE_ACCESS    01        /* These five are        */
  52. #define WRITE_ACCESS    02        /*    for the calls       */
  53. #define READ_ACCESS    04        /*       to access()       */
  54. #define ACCESS_EXISTS    00        /*           <etc>         */
  55. #define EDIT_ACCESS    06        /*  (this is r+w access)   */
  56.  
  57. #define BIG_NUM        999999        /* big number!             */
  58. #define BIGGER_NUM    9999999     /* bigger number!          */
  59.  
  60. #define START_ENCODE    "[encode]"
  61. #define END_ENCODE    "[clear]"
  62.  
  63. #define DONT_SAVE    "[no save]"
  64.  
  65. #define alias_file    ".aliases"
  66. #define group_file    ".groups"
  67. #define system_file    ".systems"
  68.  
  69. /** some defines for the "status" field of the header record **/
  70.  
  71. #define TAGGED        1        /* these are bit masks */
  72. #define DELETED        2
  73. #define EXPIRED        4
  74. #define ACTION        8
  75. #define NEW        16
  76. #define PRIORITY    32
  77.  
  78. /** some months... **/
  79.  
  80. #define JANUARY        0            /* months of the year */
  81. #define FEBRUARY    1
  82. #define MARCH        2
  83. #define APRIL        3
  84. #define MAY        4
  85. #define JUNE        5
  86. #define JULY        6
  87. #define AUGUST        7
  88. #define SEPTEMBER    8
  89. #define OCTOBER        9
  90. #define NOVEMBER    10
  91. #define DECEMBER    11
  92.  
  93. #define equal(s,w)    (strcmp(s,w) == 0)
  94. #define min(a,b)    a < b? a : b
  95. #define ctrl(c)            c - 'A' + 1    /* control character mapping */
  96. #define plural(n)    n == 1 ? "" : "s"
  97. #define lastch(s)    s[strlen(s)-1]
  98. #define no_ret(s)    if (lastch(s) == '\n') lastch(s) = '\0' 
  99. #define first_word(s,w) (strncmp(s,w, strlen(w)) == 0)
  100. #define ClearLine(n)    MoveCursor(n,0); CleartoEOLN()
  101. #define whitespace(c)    (c == ' ' || c == '\t')
  102. #define quote(c)    (c == '"' || c == '\'') 
  103. #define onoff(n)    (n == 0 ? "OFF" : "ON")
  104.  
  105. /** The next function is so certain commands can be processed from the showmsg
  106.     routine without rewriting the main menu in between... **/
  107.  
  108. #define special(c)    (c == 'j' || c == 'k')
  109.  
  110. /** and a couple for dealing with status flags... **/
  111.  
  112. #define ison(n,mask)    (n & mask)
  113. #define isoff(n,mask)    (~ison(n, mask))
  114.  
  115. #define setit(n,mask)        n |= mask
  116. #define clearit(n, mask)    n &= ~mask
  117.  
  118. /** a few for the usage of function keys... **/
  119.  
  120. #define f1    1
  121. #define f2    2
  122. #define f3    3
  123. #define f4    4
  124. #define f5    5
  125. #define f6    6
  126. #define f7    7
  127. #define f8    8
  128.  
  129. #define MAIN    0
  130. #define ALIAS   1
  131. #define YESNO    2
  132. #define CHANGE  3
  133. #define READ    4
  134.  
  135. /** some possible sort styles... **/
  136.  
  137. #define REVERSE        -        /* for reverse sorting           */
  138. #define SENT_DATE    1        /* the date message was sent     */
  139. #define RECEIVED_DATE    2        /* the date message was received */
  140. #define SENDER        3        /* the name/address of sender    */
  141. #define SIZE        4        /* the # of lines of the message */
  142. #define SUBJECT        5        /* the subject of the message    */
  143. #define STATUS        6        /* the status (deleted, etc)     */
  144.  
  145. /* wouldn't it be nice to have variable argument macros... */
  146.  
  147. #define dprint0(n,s)         if (debug >= n) { \
  148.                 fprintf(debugfile, s); fflush(debugfile); }
  149.  
  150. #define dprint1(n,s,a)         if (debug >= n) { \
  151.                 fprintf(debugfile, s, a);  fflush(debugfile); }
  152.  
  153. #define dprint2(n,s,a,b)     if (debug >= n) { \
  154.                     fprintf(debugfile, s, a, b); fflush(debugfile);}
  155.  
  156. #define dprint3(n,s,a,b,c)   if (debug >= n) { fprintf(debugfile, \
  157.                 s, a, b, c); fflush(debugfile); }
  158.  
  159. #define dprint4(n,s,a,b,c,d)  if (debug >= n) { fprintf(debugfile, \
  160.                 s, a, b, c, d); fflush(debugfile); }
  161.  
  162. #define dprint5(n,s,a,b,c,d,e) if (debug >= n) { fprintf(debugfile, \
  163.                     s, a, b, c, d, e); fflush(debugfile); }
  164.  
  165. #define dprint6(n,s,a,b,c,d,e,f) if (debug >= n) { fprintf(debugfile, \
  166.                     s, a, b, c, d, e, f); fflush(debugfile); }
  167.  
  168. /* I guess this corrects it, though.  Wretched stuff though! */
  169.  
  170. /* some random records... */
  171.  
  172. struct date_rec {
  173.     int  month;        /** this record stores a **/
  174.     int  day;        /**   specific date and  **/
  175.     int  year;        /**     time...         **/
  176.     int  hour;
  177.     int  minute;
  178.        };
  179.  
  180. struct header_rec {
  181.     int  lines;        /** # of lines in the message  **/
  182.     int  status;        /** Urgent, Deleted, Expired?  **/
  183.     int  index_number;    /** relative loc in file...    **/
  184.     long offset;        /** offset in bytes of message **/
  185.     struct date_rec received; /** when elm received here   **/
  186.     char from[STRING];    /** who sent the message?      **/
  187.     char to[STRING];    /** who it was sent to           **/
  188.     char dayname[8];    /**  when the                  **/
  189.     char month[10];        /**        message             **/
  190.     char day[3];        /**          was            **/
  191.     char year[5];        /**            sent            **/
  192.     char time[NLEN];    /**              to you!       **/
  193.     char subject[STRING];   /** The subject of the mail    **/
  194.        };
  195.  
  196. struct alias_rec {
  197.     char   name[NLEN];    /* alias name                  */
  198.     long   byte;        /* offset into data file for address */
  199.        };
  200.  
  201. struct lsys_rec {
  202.     char   name[NLEN];    /* name of machine connected to      */
  203.     struct lsys_rec *next;    /* linked list pointer to next       */
  204.        };
  205.  
  206. struct addr_rec {
  207.      char   address[NLEN];    /* machine!user you get mail as      */
  208.      struct addr_rec *next;    /* linked list pointer to next       */
  209.     };
  210.