1: /* $Header: head.h,v 4.3 85/05/01 11:38:31 lwall Exp $
2: *
3: * $Log: head.h,v $
4: * Revision 4.3 85/05/01 11:38:31 lwall
5: * Baseline for release with 4.3bsd.
6: *
7: */
8:
9: #define HEAD_FIRST 1
10:
11: /* types of header lines (if only C really believed in enums)
12: * (These must stay in alphabetic order at least in the first letter.
13: * Within each letter it helps to arrange in increasing likelihood.)
14: */
15:
16: #define 0 /* body */
17: #define SOME_LINE 1 /* unrecognized */
18: #define ARTID_LINE 2 /* article-i.d. */
19: #define APPR_LINE 3 /* approved */
20: #define DIST_LINE 4 /* distribution */
21: #define DATE_LINE 5 /* date */
22: #define RECEIVED_LINE 6 /* date-received */
23: #define EXPIR_LINE 7 /* expires */
24: #define FOLLOW_LINE 8 /* followup-to */
25: #define FROM_LINE 9 /* from */
26: #define KEYW_LINE 10 /* keywords */
27: #define LINES_LINE 11 /* lines */
28: #define MESSID_LINE 12 /* message-id */
29: #define NFFR_LINE 13 /* nf-from */
30: #define NFID_LINE 14 /* nf-id */
31: #define NGS_LINE 15 /* newsgroups */
32: #define ORG_LINE 16 /* organization */
33: #define PATH_LINE 17 /* path */
34: #define POSTED_LINE 18 /* posted */
35: #define PVER_LINE 19 /* posting-version */
36: #define REPLY_LINE 20 /* reply-to */
37: #define REFS_LINE 21 /* references */
38: #define RVER_LINE 22 /* relay-version */
39: #define SENDER_LINE 23 /* sender */
40: #define SUMRY_LINE 24 /* summary */
41: #define SUBJ_LINE 25 /* subject */
42: #define XREF_LINE 26 /* xref */
43:
44: #define HEAD_LAST 27 /* one more than the last one above */
45:
46: struct headtype {
47: char *ht_name; /* header line identifier */
48: #ifdef pdp11
49: short ht_minpos;
50: short ht_maxpos;
51: #else
52: ART_POS ht_minpos; /* pointer to beginning of line in article */
53: ART_POS ht_maxpos; /* pointer to end of line in article */
54: #endif
55: char ht_length; /* could make these into nybbles but */
56: char ht_flags; /* it wouldn't save space normally */
57: }; /* due to alignment considerations */
58:
59: #define HT_HIDE 1 /* -h on this line */
60: #define HT_MAGIC 2 /* do any special processing on this line */
61:
62: /* This array must stay in the same order as the list above */
63:
64: #ifndef DOINIT
65: EXT struct headtype htype[HEAD_LAST];
66: #else
67: struct headtype htype[HEAD_LAST] = {
68: /* name minpos maxpos length flag */
69: {"BODY", 0, 0, 4, 0 },
70: {"unrecognized", 0, 0, 12, 0 },
71: {"article-i.d.", 0, 0, 12, HT_HIDE },
72: {"approved", 0, 0, 8, HT_HIDE },
73: {"distribution", 0, 0, 12, 0 },
74: {"date", 0, 0, 4, 0 },
75: {"date-received", 0, 0, 13, 0 },
76: {"expires", 0, 0, 7, HT_HIDE|HT_MAGIC},
77: {"followup-to", 0, 0, 11, 0 },
78: {"from", 0, 0, 4, 0 },
79: {"keywords", 0, 0, 8, 0 },
80: {"lines", 0, 0, 5, 0 },
81: {"message-id", 0, 0, 10, 0 },
82: {"nf-from", 0, 0, 7, HT_HIDE },
83: {"nf-id", 0, 0, 5, HT_HIDE },
84: {"newsgroups", 0, 0, 10, HT_MAGIC|HT_HIDE},
85: {"organization", 0, 0, 12, 0 },
86: {"path", 0, 0, 4, HT_HIDE },
87: {"posted", 0, 0, 6, HT_HIDE },
88: {"posting-version", 0, 0, 15, HT_HIDE },
89: {"reply-to", 0, 0, 8, 0 },
90: {"references", 0, 0, 10, 0 },
91: {"relay-version", 0, 0, 13, HT_HIDE },
92: {"sender", 0, 0, 6, 0 },
93: {"summary", 0, 0, 7, 0 },
94: {"subject", 0, 0, 7, HT_MAGIC },
95: {"xref", 0, 0, 4, HT_HIDE }
96: };
97: #endif
98:
99: #ifdef ASYNC_PARSE
100: EXT ART_NUM parsed_art INIT(0);
101: #endif
102:
103: EXT char INIT(0); /* are we decoding the header? */
104:
105: #ifdef CACHESUBJ
106: EXT char **subj_list INIT(Null(char **));
107: #endif
108:
109: void head_init();
110: int set_line_type();
111: void start_header();
112: bool parseline();
113: #ifdef ASYNC_PARSE
114: int parse_maybe();
115: #endif
116: char *fetchsubj();
117: char *fetchlines();