home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / OFFLINE / UQWK18.ZIP / UQWK18.TAR / uqwk.h < prev    next >
C/C++ Source or Header  |  1994-02-10  |  7KB  |  220 lines

  1. /*
  2.  *  Header for uqwk
  3.  */
  4.  
  5. #define UQWK_VERSION    "1.8"
  6.  
  7. #ifdef ALLOCATE
  8. #define EXTERN
  9. #else
  10. #define EXTERN extern
  11. #endif
  12.  
  13. #define    PATH_LEN    (256)    /* Length for file names, etc. */
  14. #define BUF_LEN        (4096)    /* Length of general purpose buffer */
  15.  
  16. #define QWK_EOL        (227)    /* QWK end-of-line */
  17. #define QWK_ACT_FLAG    (225)    /* Active message flag */
  18. #define QWK_PUBLIC    ' '    /* Public message flags */
  19. #define QWK_PUBLIC2    '-'
  20. #define QWK_PRIVATE    '+'    /* Private message flags */
  21. #define QWK_PRIVATE2    '*'
  22.  
  23. #define MAILER_PATH    "mail"    /* Where to find mailer */
  24. #define INEWS_PATH    "/usr/lib/news/inews"    /* Where to find inews */
  25.  
  26. #define SLNP_MAILER    "/usr/lib/sendmail -t"
  27. #define SLNP_INEWS    "/usr/lib/news/inews -h"
  28.  
  29. #define ZIP_MAILER    "/usr/lib/sendmail"
  30. #define ZIP_INEWS    "/usr/lib/news/inews -h"
  31.  
  32. #define XPRT_MAILER    "/usr/lib/sendmail -t"
  33. #define XPRT_INEWS    "/usr/lib/news/inews -h"
  34.  
  35. #define MAIL_CONF_NAME  "Email"
  36.  
  37. /* Defaults */
  38. #define    DEF_MAIL_DIR    "/usr/spool/mail"
  39. #define DEF_DO_MAIL    (1)
  40. #define DEF_DO_NEWS    (0)
  41. #define DEF_INC_HDRS    (1)
  42. #define DEF_PRT_OPTS    (0)
  43. #define DEF_READ_ONLY    (0)
  44. #define DEF_WAF_MODE    (0)
  45. #define DEF_SLNP_MODE    (0)
  46. #define DEF_ZIP_MODE    (0)
  47. #define DEF_XRF_MODE    (0)
  48. #define DEF_BW_KLUDGE    (0)
  49. #define DEF_XPRT_MODE    (0)
  50. #define DEF_SUM_MODE    (0)
  51. #define DEF_SEL_MODE    (0)
  52. #define DEF_EVERY_MODE    (0)
  53. #define DEF_MAX_BLKS    (4000)    /* That's half a megabyte */
  54. #define DEF_GRP_LEN    (15)
  55. #define DEF_HOME_DIR    "."
  56. #define DEF_USER_NAME    "unknown"
  57. #define DEF_MAIL_FILE    "unknown"
  58. #define DEF_BBS_NAME    "unknown BBS"
  59. #define DEF_BBS_CITY    "Anytown, USA"
  60. #define DEF_BBS_PHONE    "555-1212"
  61. #define DEF_BBS_SYSOP    "Joe Sysop"
  62. #define DEF_BBS_ID    "0,SOMEBBS"
  63. #define DEF_ACT_FILE    "/usr/lib/news/active"
  64. #define DEF_NRC_FILE    "unknown"
  65. #define DEF_NEWS_DIR    "/usr/spool/news"
  66. #define DEF_REP_FILE    "none"
  67. #define DEF_TRN_FILE    "none"
  68. #define DEF_HOST_NAME    "nowhere"
  69. #define DEF_SUM_FILE    "none"
  70. #define DEF_SEL_FILE    "none"
  71. #define DEF_NG_FILE    "none"
  72.  
  73. /* Runtime options */
  74. EXTERN    int do_mail;            /* Process mail? */
  75. EXTERN    int do_news;            /* Process news? */
  76. EXTERN    int inc_hdrs;            /* Include headers in messages? */
  77. EXTERN    int prt_opts;            /* Display options; no processing */
  78. EXTERN    int read_only;            /* Don't rewrite mail and .newsrc */
  79. EXTERN    int max_blks;            /* Maximum blocks per QWK packet */
  80. EXTERN    int grp_len;            /* Maximum newsgroup name length */
  81. EXTERN    int waf_mode;            /* Waffle type .newsrc */
  82. EXTERN    int slnp_mode;            /* Write SLNP packet */
  83. EXTERN    int zip_mode;            /* Write ZipNews packet */
  84. EXTERN    int xrf_mode;            /* Cancel crosspostings */
  85. EXTERN    int bw_kludge;            /* Blue Wave kludge */
  86. EXTERN    int xprt_mode;            /* Expert mode */
  87. EXTERN    int sum_mode;            /* Summary mode */
  88. EXTERN    int sel_mode;            /* Selection mode */
  89. EXTERN    int every_mode;            /* Write every grp to CONTROL.DAT */
  90.  
  91. EXTERN    char mail_file[PATH_LEN];    /* mail spool */
  92. EXTERN    char mail_dir[PATH_LEN];    /* dir for mail spool */
  93. EXTERN    char home_dir[PATH_LEN];    /* home directory */
  94. EXTERN    char user_name[PATH_LEN];    /* user's login name */
  95. EXTERN    char bbs_name[PATH_LEN];    /* BBS name */
  96. EXTERN    char bbs_city[PATH_LEN];    /* BBS city */
  97. EXTERN    char bbs_phone[PATH_LEN];    /* BBS phone number */
  98. EXTERN    char bbs_sysop[PATH_LEN];    /* BBS sysop name */
  99. EXTERN    char bbs_id[PATH_LEN];        /* BBS ID */
  100. EXTERN    char act_file[PATH_LEN];    /* Active file */
  101. EXTERN    char nrc_file[PATH_LEN];    /* .newsrc file */
  102. EXTERN    char news_dir[PATH_LEN];    /* News spool dir */
  103. EXTERN    char rep_file[PATH_LEN];    /* Reply packet file name */
  104. EXTERN    char trn_file[PATH_LEN];    /* Newsgroup name translation table */
  105. EXTERN    char host_name[PATH_LEN];    /* Host machine name */
  106. EXTERN    char sum_file[PATH_LEN];    /* Summary file */
  107. EXTERN    char sel_file[PATH_LEN];    /* Selection file */
  108. EXTERN    char ng_file[PATH_LEN];        /* Desired ng file */
  109.  
  110. char *getenv();
  111. char *Fgets();
  112. char *ParseFrom();
  113. struct act_ent *FindActive();
  114. struct sub_ent *SubList();
  115. struct sub_ent *MarkRead();
  116. struct sub_ent *FixSub();
  117. struct conf_ent *NewConference();
  118.  
  119. /* Various globals */
  120. EXTERN    char *progname;            /* Program name */
  121. EXTERN    int msg_cnt;            /* Total number of messages */
  122. EXTERN    int conf_cnt;            /* Total number of conferences */
  123. EXTERN    FILE *msg_fd;            /* MESSAGES.DAT file desc */
  124. EXTERN    char msg_fn[PATH_LEN];        /* SLNP *.MSG file name */
  125. EXTERN    FILE *ctl_fd;            /* CONTROL.DAT file desc */
  126. EXTERN    FILE *ndx_fd;            /* xxx.NDX file desc */
  127. EXTERN    char ndx_fn[PATH_LEN];        /* xxx.NDX file name */
  128. EXTERN    FILE *act_fd;            /* Active file file desc */
  129. EXTERN    FILE *nrc_fd;            /* .newsrc file desc */
  130. EXTERN    FILE *rep_fd;            /* Reply packet file desc */
  131. EXTERN    FILE *nws_fd;            /* ZipNews .nws file desc */
  132. EXTERN    FILE *idx_fd;            /* ZipNews .idx file desc */
  133. EXTERN    FILE *mai_fd;            /* ZipNews .mai file desc */
  134. EXTERN    int zip_flag;            /* idx entry written for this ng? */
  135. EXTERN    unsigned char buf[BUF_LEN];    /* General purpose buffer */
  136. EXTERN    int blk_cnt;            /* Blocks written to messages.dat */
  137. EXTERN    int sum_flag;            /* Summary hdr for this ng yet? */
  138. EXTERN    FILE *sum_fd;            /* Summary file desc */
  139. EXTERN    FILE *sel_fd;            /* Selection file desc */
  140.  
  141. /* This is the stuff we remember about each spooled mail message */
  142. EXTERN    struct mail_ent
  143. {
  144.     long begin;        /* Offset of start of header */
  145.     long text;        /* Offset to end of header, start of text */
  146.     long end;        /* Offset to start of next message */
  147.     struct mail_ent *next;    /* Pointer to next */
  148. } *mail_list;
  149.  
  150. /* This is stuff we remember about each "conference" */
  151. EXTERN    struct conf_ent
  152. {
  153.     char *name;        /* Conference name */
  154.     int number;        /* Conference number */
  155.     int count;        /* Number of articles in this conference */
  156.     struct conf_ent *next;    /* Pointer to next */
  157. } *conf_list, *last_conf;
  158.  
  159. /* This is the QWK message header format */
  160. struct qwk_hdr
  161. {
  162.     unsigned char status;
  163.     unsigned char number[7];
  164.     unsigned char date[8];
  165.     unsigned char time[5];
  166.     unsigned char to[25];
  167.     unsigned char from[25];
  168.     unsigned char subject[25];
  169.     unsigned char password[12];
  170.     unsigned char refer[8];
  171.     unsigned char blocks[6];
  172.     unsigned char flag;
  173.     unsigned char conference[2];
  174.     unsigned char msg_num[2];
  175.     unsigned char tag;
  176. };
  177.  
  178. EXTERN    struct qwk_hdr rep_hdr;        /* Header for replies */
  179.  
  180. /* Stuff we remember about each active newsgroup */
  181. EXTERN    struct act_ent
  182. {
  183.     char *name;        /* Newsgroup name */
  184.     int hi;            /* High article number */
  185.     int lo;            /* Low article number */
  186.     struct act_ent *next;    /* Pointer to next */
  187. } *act_list;
  188.  
  189. /* Stuff we remember about the .newsrc file */
  190. EXTERN    struct nrc_ent
  191. {
  192.     char *name;        /* Newsgroup name */
  193.     int subscribed;        /* Subscribed flag */
  194.     struct sub_ent *sub;    /* Subscription list */
  195.     int conf;        /* Corresponding conference number */
  196.     struct nrc_ent *next;    /* Pointer to next */
  197. } *nrc_list;
  198.  
  199. /* Stuff we remember about the newsgroup name translation table */
  200. EXTERN    struct trn_ent
  201. {
  202.     char *old;        /* Old name */
  203.     char *new;        /* New name */
  204.     struct trn_ent *next;    /* Pointer to next */
  205. } *trn_list;
  206.  
  207. /* Stuff we remember about a subscription list (in the .newsrc) */
  208. struct sub_ent
  209. {
  210.     int lo, hi;        /* Range of articles */
  211.     struct sub_ent *next;    /* Pointer to next */
  212. };
  213.  
  214. /* Stuff we remember about the desired newsgroup list */
  215. EXTERN    struct ng_ent
  216. {
  217.     char *name;        /* Newsgroup name */
  218.     struct ng_ent *next;    /* Pointer to next */
  219. } *ng_list;
  220.