home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / aix-rs6000 / elm2.3.11.AIX3.1.5.Z / elm2.3.11.AIX3.1.5 / hdrs / defs.h < prev    next >
C/C++ Source or Header  |  1991-11-26  |  12KB  |  391 lines

  1.  
  2. /* $Id: defs.h,v 4.1.1.2 90/06/05 21:23:19 syd Exp $ */
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 4.1.1.2 $   $State: Exp $
  6.  *
  7.  *             Copyright (c) 1986, 1987 Dave Taylor
  8.  *             Copyright (c) 1988, 1989, 1990 USENET Community Trust
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log:    defs.h,v $
  17.  * Revision 4.1.1.2  90/06/05  21:23:19  syd
  18.  * Fix other side of same problem
  19.  * From: Syd
  20.  * 
  21.  * Revision 4.1.1.1  90/06/05  21:16:42  syd
  22.  * Try and avoid double definitions for the null
  23.  * macro for htonl when the system includes aready
  24.  * have it
  25.  * From: Syd
  26.  * 
  27.  * Revision 4.1  90/04/28  22:42:06  syd
  28.  * checkin of Elm 2.3 as of Release PL0
  29.  * 
  30.  *
  31.  ******************************************************************************/
  32.  
  33. /**  define file for ELM mail system.  **/
  34.  
  35.  
  36. #include "../config.h"
  37. #include "sysdefs.h"    /* system/configurable defines */
  38.  
  39.  
  40. # define VERSION         "2.3"        /* Version number... */
  41. # define VERS_DATE    "May 1, 1990"        /* for elm -v option */
  42. # define WHAT_STRING    \
  43.     "@(#) Version 2.3, USENET supported version, released May 1990"
  44.  
  45. #define KLICK        25
  46.  
  47. #define SLEN        256        /* long for ensuring no overwrites... */
  48. #define SHORT        10        /* super short strings!          */
  49. #define NLEN        48        /* name length for aliases            */
  50. #define WLEN        20
  51. #define STRING        128    /* reasonable string length for most..      */
  52. #define LONG_STRING    512    /* even longer string for group expansion   */
  53. #define VERY_LONG_STRING 2560    /* huge string for group alias expansion    */
  54. #define MAX_LINE_LEN    5120    /* even bigger string for "filter" prog..   */
  55.  
  56. #define BREAK        '\0'          /* default interrupt    */
  57. #define BACKSPACE    '\b'         /* backspace character  */
  58. #define TAB        '\t'            /* tab character        */
  59. #define RETURN        '\r'         /* carriage return char */
  60. #define LINE_FEED    '\n'         /* line feed character  */
  61. #define FORMFEED    '\f'         /* form feed (^L) char  */
  62. #define COMMA        ','        /* comma character      */
  63. #define SPACE        ' '        /* space character      */
  64. #define DOT        '.'        /* period/dot character */
  65. #define BANG        '!'        /* exclaimation mark!   */
  66. #define AT_SIGN        '@'        /* at-sign character    */
  67. #define PERCENT        '%'        /* percent sign char.   */
  68. #define COLON        ':'        /* the colon ..        */
  69. #define BACKQUOTE    '`'        /* backquote character  */
  70. #define TILDE_ESCAPE    '~'        /* escape character~    */
  71. #define ESCAPE        '\033'        /* the escape        */
  72.  
  73. #define NO_OP_COMMAND    '\0'        /* no-op for timeouts   */
  74.  
  75. #define STANDARD_INPUT  0        /* file number of stdin */
  76.  
  77. #ifndef TRUE
  78. #define TRUE        1
  79. #define FALSE        0
  80. #endif
  81.  
  82. #define NO        0
  83. #define YES        1
  84. #define MAYBE        2        /* a definite define, eh?  */
  85. #define FORM        3        /*      <nevermind>        */
  86. #define PREFORMATTED    4        /* forwarded form...       */
  87.  
  88. #define SAME_PAGE    1        /* redraw current only     */
  89. #define NEW_PAGE    2        /* redraw message list     */
  90. #define ILLEGAL_PAGE    0        /* error in page list, punt */
  91.  
  92. #define PAD        0        /* for printing name of    */
  93. #define FULL        1        /*   the sort we're using  */
  94.  
  95. #define OUTGOING    0        /* defines for lock file   */
  96. #define INCOMING    1        /* creation..see lock()    */
  97.  
  98. #define SH        0        /* defines for system_call */
  99. #define USER_SHELL    1        /* to work correctly!      */
  100.  
  101. #define EXECUTE_ACCESS    01        /* These five are        */
  102. #define WRITE_ACCESS    02        /*    for the calls       */
  103. #define READ_ACCESS    04        /*       to access()       */
  104. #define ACCESS_EXISTS    00        /*           <etc>         */
  105. #define EDIT_ACCESS    06        /*  (this is r+w access)   */
  106.  
  107. #define BIG_NUM        999999        /* big number!             */
  108. #define BIGGER_NUM    9999999     /* bigger number!          */
  109.  
  110. #define START_ENCODE    "[encode]"
  111. #define END_ENCODE    "[clear]"
  112.  
  113. #define DONT_SAVE    "[no save]"
  114. #define DONT_SAVE2    "[nosave]"
  115.  
  116. #define alias_file    ".aliases"
  117. #define group_file    ".groups"
  118. #define system_file    ".systems"
  119.  
  120. #define default_folders        "Mail"
  121. #define default_recvdmail    "=received"
  122. #define default_sentmail    "=sent"
  123.  
  124. /** some defines for the 'userlevel' variable... **/
  125.  
  126. #define RANK_AMATEUR    0
  127. #define AMATEUR        1
  128. #define OKAY_AT_IT    2
  129. #define GOOD_AT_IT    3
  130. #define EXPERT        4
  131. #define SUPER_AT_IT    5
  132.  
  133. /** some defines for the "status" field of the header record **/
  134.  
  135. #define ACTION        1        /* bit masks, of course */
  136. #define CONFIDENTIAL    2
  137. #define DELETED        4
  138. #define EXPIRED        8
  139. #define FORM_LETTER    16
  140. #define NEW        32
  141. #define PRIVATE        64
  142. #define TAGGED        128
  143. #define URGENT        256
  144. #define VISIBLE        512
  145. #define UNREAD        1024
  146. #define STATUS_CHANGED    2048
  147.  
  148. #define UNDELETE    0        /* purely for ^U function... */
  149.  
  150. /** values for headers exit_disposition field */
  151. #define UNSET    0
  152. #define KEEP    1
  153. #define    STORE    2
  154. #define DELETE    3
  155.  
  156. /** some months... **/
  157.  
  158. #define JANUARY        0            /* months of the year */
  159. #define FEBRUARY    1
  160. #define MARCH        2
  161. #define APRIL        3
  162. #define MAY        4
  163. #define JUNE        5
  164. #define JULY        6
  165. #define AUGUST        7
  166. #define SEPTEMBER    8
  167. #define OCTOBER        9
  168. #define NOVEMBER    10
  169. #define DECEMBER    11
  170.  
  171. #define equal(s,w)    (strcmp(s,w) == 0)
  172. #define min(a,b)    a < b? a : b
  173. #define ctrl(c)            c - 'A' + 1    /* control character mapping */
  174. #define plural(n)    n == 1 ? "" : "s"
  175. #define lastch(s)    s[strlen(s)-1]
  176.  
  177. /* find tab stops preceding or following a given column position 'a', where
  178.  * the column position starts counting from 1, NOT 0!
  179.  * The external integer "tabspacing" must be declared to use this. */
  180. #define prev_tab(a)    (((((a-1)/tabspacing))*tabspacing)+1)
  181. #define next_tab(a)    (((((a-1)/tabspacing)+1)*tabspacing)+1)
  182.  
  183. #define movement_command(c)    (c == 'j' || c == 'k' || c == ' ' ||           \
  184.                  c == BACKSPACE || c == ESCAPE || c == '*' || \
  185.                  c == '-' || c == '+' || c == '=' ||          \
  186.                  c == '#' || c == '@' || c == 'x' ||           \
  187.                  c == 'a' || c == 'q')
  188.  
  189. #define no_ret(s)    { register int xyz; /* varname is for lint */          \
  190.                   for (xyz=strlen(s)-1; xyz >= 0 &&               \
  191.                 (s[xyz] == '\r' || s[xyz] == '\n'); )          \
  192.                  s[xyz--] = '\0';                                 \
  193.             }
  194.               
  195. #define first_word(s,w) (strncmp(s,w, strlen(w)) == 0)
  196. #define ClearLine(n)    MoveCursor(n,0); CleartoEOLN()
  197. #define whitespace(c)    (c == ' ' || c == '\t')
  198. #define ok_rc_char(c)    (isalnum(c) || c == '-' || c == '_')
  199. #define ok_alias_char(c) (isalnum(c) || c == '-' || c == '_' || c == '.')
  200. #define quote(c)    (c == '"' || c == '\'') 
  201. #define onoff(n)    (n == 0 ? "OFF" : "ON")
  202.  
  203. /** The next function is so certain commands can be processed from the showmsg
  204.     routine without rewriting the main menu in between... **/
  205.  
  206. #define special(c)    (c == 'j' || c == 'k')
  207.  
  208. /** and a couple for dealing with status flags... **/
  209.  
  210. #define ison(n,mask)    (n & mask)
  211. #define isoff(n,mask)    (!ison(n, mask))
  212.  
  213. #define setit(n,mask)        n |= mask
  214. #define clearit(n, mask)    n &= ~mask
  215.  
  216. /** a few for the usage of function keys... **/
  217.  
  218. #define f1    1
  219. #define f2    2
  220. #define f3    3
  221. #define f4    4
  222. #define f5    5
  223. #define f6    6
  224. #define f7    7
  225. #define f8    8
  226.  
  227. #define MAIN    0
  228. #define ALIAS   1
  229. #define YESNO    2
  230. #define CHANGE  3
  231. #define READ    4
  232.  
  233. #define MAIN_HELP    0
  234. #define OPTIONS_HELP 1
  235. #define ALIAS_HELP   2
  236. #define PAGER_HELP   3
  237.  
  238. /** types of folders **/
  239. #define NO_NAME        0        /* variable contains no file name */
  240. #define NON_SPOOL    1        /* mailfile not in mailhome */
  241. #define SPOOL        2        /* mailfile in mailhome */
  242.  
  243. /* the following is true if the current mailfile is the user's spool file*/
  244. #define USERS_SPOOL    (strcmp(cur_folder, defaultfile) == 0)
  245.  
  246. /** some possible sort styles... **/
  247.  
  248. #define REVERSE        -        /* for reverse sorting           */
  249. #define SENT_DATE    1        /* the date message was sent     */
  250. #define RECEIVED_DATE    2        /* the date message was received */
  251. #define SENDER        3        /* the name/address of sender    */
  252. #define SIZE        4        /* the # of lines of the message */
  253. #define SUBJECT        5        /* the subject of the message    */
  254. #define STATUS        6        /* the status (deleted, etc)     */
  255. #define MAILBOX_ORDER    7        /* the order it is in the file   */
  256.  
  257. /* some stuff for our own malloc call - pmalloc */
  258.  
  259. #define PMALLOC_THRESHOLD    256    /* if greater, then just use malloc */
  260. #define PMALLOC_BUFFER_SIZE    2048    /* internal [memory] buffer size... */
  261.  
  262. /** the following macro is as suggested by Larry McVoy.  Thanks! **/
  263.  
  264. # ifdef DEBUG
  265. #  define   dprint(n,x)        {                 \
  266.                    if (debug >= n)  {        \
  267.                      fprintf x ;         \
  268.                      fflush(debugfile);         \
  269.                    }                \
  270.                 }
  271. # else
  272. #  define   dprint(n,x)
  273. # endif
  274.  
  275. /* some random structs... */
  276.  
  277. struct date_rec {
  278.     int  month;        /** this record stores a **/
  279.     int  day;        /**   specific date and  **/
  280.     int  year;        /**     time...         **/
  281.     int  hour;
  282.     int  minute;
  283.        };
  284.  
  285. struct header_rec {
  286.     int  lines;        /** # of lines in the message  **/
  287.     int  status;        /** Urgent, Deleted, Expired?  **/
  288.     int  index_number;    /** relative loc in file...    **/
  289.     int  encrypted;        /** whether msg has encryption **/
  290.     int  exit_disposition;    /** whether to keep, store, delete **/
  291.     int  status_chgd;    /** whether became read or old, etc. **/
  292.     long offset;        /** offset in bytes of message **/
  293.     struct date_rec received; /** when elm received here   **/
  294.     char from[STRING];    /** who sent the message?      **/
  295.     char to[STRING];    /** who it was sent to           **/
  296.     char messageid[STRING];    /** the Message-ID: value      **/
  297.     char dayname[8];    /**  when the                  **/
  298.     char month[10];        /**        message             **/
  299.     char day[3];        /**          was            **/
  300.     char year[5];        /**            sent            **/
  301.     char time[NLEN];    /**              to you!       **/
  302.     char time_zone[12];    /**                incl. tz    */
  303.     long time_sent;        /** gmt when sent for sorting  **/
  304.     char subject[STRING];   /** The subject of the mail    **/
  305.     char mailx_status[WLEN];/** mailx status flags (RO...) **/
  306.        };
  307.  
  308. struct alias_rec {
  309.     char   name[NLEN];    /* alias name                  */
  310.     long   byte;        /* offset into data file for address */
  311.        };
  312.  
  313. struct lsys_rec {
  314.     char   name[NLEN];    /* name of machine connected to      */
  315.     struct lsys_rec *next;    /* linked list pointer to next       */
  316.        };
  317.  
  318. struct addr_rec {
  319.      char   address[NLEN];    /* machine!user you get mail as      */
  320.      struct addr_rec *next;    /* linked list pointer to next       */
  321.     };
  322.  
  323. #ifdef SHORTNAMES    /* map long names to shorter ones */
  324. # include <shortname.h>
  325. #endif
  326.  
  327. /** Let's make sure that we're not going to have any annoying problems with 
  328.     int pointer sizes versus char pointer sizes by guaranteeing that every-
  329.     thing vital is predefined... (Thanks go to Detlev Droege for this one)
  330. **/
  331.  
  332. #ifdef STRINGS
  333. #  include <strings.h>
  334. #else
  335. #  include <string.h>
  336. #endif
  337.  
  338. /*
  339.  * Macros for network/external number representation conversion.
  340.  *    Note, some system include files already have htonl defined
  341.  *    as this same macro, the ifndef should prevent conflicts.
  342.  */
  343. #ifdef NETWORK_ORDER
  344. #  ifndef ntohl
  345. unsigned short    ntohs(), htons();
  346. unsigned long    ntohl(), htonl();
  347. #  endif
  348. #else
  349. #  ifndef ntohl
  350. #     define    ntohl(x)    (x)
  351. #     define    ntohs(x)    (x)
  352. #     define    htonl(x)    (x)
  353. #     define    htons(x)    (x)
  354. #  endif
  355. #endif
  356.  
  357. char *argv_zero();
  358. char *bounce_off_remote();
  359. char *ctime();
  360. char *error_description();
  361. char *error_name();
  362. char *error_number();
  363. char *expand_address();
  364. char *expand_domain();
  365. char *expand_group();
  366. char *expand_logname();
  367. char *expand_system();
  368. char *find_path_to();
  369. char *format_long();
  370. char *get_alias_address();
  371. char *get_arpa_date();
  372. char *get_ctime_date();
  373. char *get_date();
  374. char *get_token();
  375. char *getenv();
  376. char *getlogin();
  377. char *level_name();
  378. char *match_and_expand_domain();
  379. char *shift_lower();
  380. char *strip_commas();
  381. char *strip_parens();
  382. char *strpbrk();
  383. char *strtok();
  384. char *tail_of_string();
  385. char *tgetstr();
  386. char *pmalloc();
  387.  
  388. long lseek();
  389. long times();
  390. long ulimit();
  391.