home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / readnews / defs.h < prev    next >
C/C++ Source or Header  |  1994-09-07  |  3KB  |  120 lines

  1. #include <sys/types.h>
  2. #include <sys/stat.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <ctype.h>
  7. #include <time.h>
  8. #include <fcntl.h>
  9. #include <signal.h>
  10.  
  11. /* C News header(s) */
  12. #include <config.h>
  13.  
  14. #define NEWSVERSION     "B UNSW 1.1 19 Sep 1984, heavily hacked for C News"
  15.  
  16. /* Things that very well may require local configuration */
  17.  
  18. /*#define UNSWMAIL 1*/            /* if you have UNSW "mail" which
  19.                        allows "-s subject -i include_file"
  20.                        arguments */
  21. #define MAIL    "/bin/mail"
  22. #if UNSWMAIL
  23. #define FASTMAIL    "/bin/mail"
  24. #else
  25. #define FASTMAIL    MAIL
  26. #endif
  27.  
  28.  
  29. /* Things you might want to change */
  30.  
  31. #define NEWSRC  ".newsrc"        /* name of .newsrc file */
  32. #define    PAGESIZE 24            /* lines on screen */
  33. #define ARTICLES "articles"        /* default place to save articles */
  34. #define BUFLEN    256            /* standard buffer size */
  35.  
  36. /* Things you probably won't want to change */
  37.  
  38. #define NEGCHAR    '!'            /* newsgroup negation character    */
  39. #define NEGS    "!"            /* ditto (string) */
  40. #define BADGRPCHARS "/#!"        /* illegal chars in group name */
  41. #define    NGSEPCHAR ','    /* delimit character in news group line        */
  42. #define NGSEPS    ","    /* ditto */
  43. #define PSEPS "!"    /* separator in Path: */
  44. #define PSEPCHAR '!'    /* ditto */
  45. #define TRUE    1
  46. #define FALSE    0
  47.  
  48. typedef enum booltype { false = 0, true } bool;
  49. typedef enum applytype { stop, next, nextgroup, searchgroup } applycom;
  50. typedef applycom (*apcmfunc)();
  51. typedef enum pheadtype { printing, passing, making } pheadcom;
  52.  
  53. /*
  54.  * header structure
  55.  */
  56. typedef struct header {
  57.     /* mandatory fields */
  58.     char    *h_relayversion;
  59.     char    *h_postversion;
  60.     char    *h_from;
  61.     char    *h_date;
  62.     char    *h_newsgroups;
  63.     char    *h_subject;
  64.     char    *h_messageid;
  65.     char    *h_path;
  66.     /* optional fields */
  67.     char    *h_replyto;
  68.     char    *h_sender;
  69.     char    *h_followupto;
  70.     char    *h_datereceived;
  71.     char    *h_expires;
  72.     char    *h_references;
  73.     char    *h_control;
  74.     char    *h_distribution;
  75.     char    *h_organisation;
  76.     char    *h_lines;
  77.     /* any we don't recognise */
  78.     char    *h_others;
  79. } header;
  80.  
  81. /*
  82.  * internal structure for active file
  83.  */
  84. typedef struct active active;
  85. struct active {
  86.     char    *a_name;
  87.     long    a_seq;
  88.     long    a_low;
  89.     active    *a_next;
  90. };
  91.  
  92. /*
  93.  * internal struct for newsrc file
  94.  */
  95. typedef struct newsrc newsrc;
  96. struct newsrc {
  97.     char    *n_name;
  98.     bool    n_subscribe;
  99.     long    n_last;
  100.     newsrc    *n_next;
  101. };
  102.  
  103. /* some of these may not exist any more */
  104. char    *itoa(), *ltoa(), *convg(), *ngsquash(), *ttoa(), *mgets(), *rconvg();
  105. char    *newstr(), *newstr2(), *newstr3(), *newstr4(), *newstr5(), *catstr();
  106. char    *catstr2(), *mtempnam(), *newstr6();
  107. char    *getunique(), *getretaddr(), *getsubject();
  108. FILE    *fopenl(), *fopenf();
  109. char    *myalloc(), *myrealloc();
  110. long    atot();
  111. int    strpcmp();
  112. active    *readactive();
  113.  
  114. #define NIL(type)    ((type *) 0)
  115. #define NEW(type)    ((type *) myalloc(sizeof(type)))
  116. #define CMP(a, b)    (*(a) != *(b) ? *(a) - *(b) : strcmp(a, b))
  117. #define CMPN(a, b, n)    (*(a) != *(b) ? *(a) - *(b) : strncmp(a, b, n))
  118.  
  119. extern char mailvia[];
  120.