home *** CD-ROM | disk | FTP | other *** search
- #ifndef _local_headers_h_
- #define _local_headers_h_
-
- /* Stolen straight from C-News <news.h>. Thanks Henry and Geoff! */
-
- /* macros, replacing functions for speed */
- #ifndef max
- #define max(a,b) ((a) > (b)? (a): (b))
- #endif
- #ifndef min
- #define min(a,b) ((a) < (b)? (a): (b))
- #endif
- #ifndef iswhite
- #define iswhite(c) ((c) == ' ' || (c) == '\t')
- #endif
- /* STREQ is an optimised strcmp(a,b)==0 */
- #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
- /* STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0 */
- #define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
-
- /*
- Begin GRn stuff
- */
- /*
- The bits in an unsigned long to use when talking about these headers
- (in alpha order by header name)
- */
- #define HEADER_DATE_B 0
- #define HEADER_DISTRIBUTION_B (HEADER_DATE_B + 1)
- #define HEADER_FOLLOWUP_TO_B (HEADER_DISTRIBUTION_B + 1)
- #define HEADER_FROM_B (HEADER_FOLLOWUP_TO_B + 1)
- #define HEADER_MESSAGE_ID_B (HEADER_FROM_B + 1)
- #define HEADER_NEWSGROUPS_B (HEADER_MESSAGE_ID_B + 1)
- #define HEADER_ORGANIZATION_B (HEADER_NEWSGROUPS_B + 1)
- #define HEADER_PATH_B (HEADER_ORGANIZATION_B + 1)
- #define HEADER_REFERENCES_B (HEADER_PATH_B + 1)
- #define HEADER_REPLY_TO_B (HEADER_REFERENCES_B + 1)
- #define HEADER_SUBJECT_B (HEADER_REPLY_TO_B + 1)
- #define HEADER_TO_B (HEADER_SUBJECT_B + 1)
- #define HEADER_X_NEWSSOFTWARE_B (HEADER_TO_B + 1)
- #define HEADER_LAST_B HEADER_X_NEWSSOFTWARE_B
- /*
- You can have ONLY 32 headers in this list...
- */
- #define HEADER_DATE (1 << HEADER_DATE_B)
- #define HEADER_DISTRIBUTION (1 << HEADER_DISTRIBUTION_B)
- #define HEADER_FOLLOWUP_TO (1 << HEADER_FOLLOWUP_TO_B)
- #define HEADER_FROM (1 << HEADER_FROM_B)
- #define HEADER_MESSAGE_ID (1 << HEADER_MESSAGE_ID_B)
- #define HEADER_NEWSGROUPS (1 << HEADER_NEWSGROUPS_B)
- #define HEADER_ORGANIZATION (1 << HEADER_ORGANIZATION_B)
- #define HEADER_PATH (1 << HEADER_PATH_B)
- #define HEADER_REFERENCES (1 << HEADER_REFERENCES_B)
- #define HEADER_REPLY_TO (1 << HEADER_REPLY_TO_B)
- #define HEADER_SUBJECT (1 << HEADER_SUBJECT_B)
- #define HEADER_TO (1 << HEADER_TO_B)
- #define HEADER_X_NEWSSOFTWARE (1 << HEADER_X_NEWSSOFTWARE_B)
- #define HEADER_LAST (1 << HEADER_LAST_B)
-
- #define MAX_HEADER_SIZE 4096
- // MAX_HEADER_SIZE is an arbitrary size that should include
- // all articles. Based on recent statistics (as of June 1992)
- // the maximum header seen on Usenet was less than 3K. This
- // size should be plenty for the forseeable future....
-
- extern char
- *Date,
- *Distribution,
- *Followup_To,
- *From,
- *Message_ID,
- *Newsgroups,
- *Organization,
- *Path,
- *References,
- *Reply_To,
- *Subject,
- *To,
- *X_NewsSoftware;
-
- extern char *header_buf; // buffer used by ScanAndLoadHeaders()
- extern int header_size; // size of header_buf
- extern int header_len; // length of header (until double newline)
-
- // options for ScanAndLoadHeaders() --
- // Don't close the article file, return the fd as the result value.
- #define OPT_DONT_CLOSE 1
-
- // the header munging routine
- int ScanAndLoadHeaders (const char *filename,
- const unsigned long headers,
- const unsigned long opt);
-
- void AllocHeaderBuf (int size);
- #endif
-