home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / trn / part02 / head.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-02  |  5.0 KB  |  155 lines

  1. /* $Id: head.h,v 4.4 1991/09/09 20:18:23 sob Exp sob $
  2.  *
  3.  * $Log: head.h,v $
  4.  * Revision 4.4  1991/09/09  20:18:23  sob
  5.  * release 4.4
  6.  *
  7.  *
  8.  * 
  9.  */
  10. /* This software is Copyright 1991 by Stan Barber. 
  11.  *
  12.  * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  13.  * use this software as long as: there is no monetary profit gained
  14.  * specifically from the use or reproduction of this software, it is not
  15.  * sold, rented, traded or otherwise marketed, and this copyright notice is
  16.  * included prominently in any copy made. 
  17.  *
  18.  * The author make no claims as to the fitness or correctness of this software
  19.  * for any use whatsoever, and it is provided as is. Any use of this software
  20.  * is at the user's own risk. 
  21.  */
  22.  
  23. #define HEAD_FIRST 1
  24.  
  25. /* types of header lines (if only C really believed in enums)
  26.  * (These must stay in alphabetic order at least in the first letter.
  27.  * Within each letter it helps to arrange in increasing likelihood.)
  28.  */
  29.  
  30. #define PAST_HEADER    0    /* body */
  31. #define SOME_LINE    1    /* unrecognized */
  32. #define ARTID_LINE    2    /* article-i.d. */
  33. #define APPR_LINE    3    /* approved */
  34. #define ACAT_LINE    4    /* ACategory (ClariNet) */
  35. #define ANPA_LINE    5    /* ANPA (ClariNet) */
  36. #define CODES_LINE    6    /* Codes (ClariNet) */
  37. #define DIST_LINE    7    /* distribution */
  38. #define DATE_LINE    8    /* date */
  39. #define RECEIVED_LINE    9    /* date-received */
  40. #define EXPIR_LINE    10    /* expires */
  41. #define FOLLOW_LINE    11    /* followup-to */
  42. #define FROM_LINE    12    /* from */
  43. #define FORM_LINE    13    /* Format (ClariNet) */
  44. #define KEYW_LINE    14    /* keywords */
  45. #define LINES_LINE    15    /* lines */
  46. #define MESSID_LINE    16    /* message-id */
  47. #define NFFR_LINE    17    /* nf-from */
  48. #define NFID_LINE    18    /* nf-id */
  49. #define NGS_LINE    19    /* newsgroups */
  50. #define NOTE_LINE    20    /* Note (ClariNet) */
  51. #define ORG_LINE    21    /* organization */
  52. #define PATH_LINE    22    /* path */
  53. #define POSTED_LINE    23    /* posted */
  54. #define PVER_LINE    24    /* posting-version */
  55. #define PRI_LINE    25    /* Priority (ClariNet) */
  56. #define REPLY_LINE    26    /* reply-to */
  57. #define REFS_LINE    27    /* references */
  58. #define RVER_LINE    28    /* relay-version */
  59. #define SENDER_LINE    29    /* sender */
  60. #define SUMRY_LINE    30    /* summary */
  61. #define SUBJ_LINE    31    /* subject */
  62. #define SLUG_LINE    32    /* Slugword (ClariNet) */
  63. #define XREF_LINE    33    /* xref */
  64. #define XSUP_LINE    34    /* X-Supersedes (ClariNet) */
  65. #define HEAD_LAST    35    /* one more than the last one above */
  66.  
  67. struct headtype {
  68.     char *ht_name;        /* header line identifier */
  69. #ifdef pdp11
  70.     short ht_minpos;
  71.     short ht_maxpos;
  72. #else
  73.     ART_POS ht_minpos;        /* pointer to beginning of line in article */
  74.     ART_POS ht_maxpos;        /* pointer to end of line in article */
  75. #endif
  76.     char ht_length;        /* could make these into nybbles but */
  77.     char ht_flags;        /* it wouldn't save space normally */
  78. };                /* due to alignment considerations */
  79.  
  80. #define HT_HIDE 1    /* -h on this line */
  81. #define HT_MAGIC 2    /* do any special processing on this line */
  82.  
  83. /* This array must stay in the same order as the list above */
  84.  
  85. #ifndef DOINIT
  86. EXT struct headtype htype[HEAD_LAST];
  87. #else
  88. struct headtype htype[HEAD_LAST] = {
  89.  /* name             minpos   maxpos  length   flag */
  90.     {"BODY",        0,    0,    4,    0        },
  91.     {"unrecognized",    0,    0,    12,    0        },
  92.     {"article-i.d.",    0,    0,    12,    HT_HIDE        },
  93.     {"approved",    0,    0,    8,    HT_HIDE        },
  94.     {"acategory",    0,    0,    9,    HT_HIDE        },
  95.     {"anpa",        0,    0,    4,    HT_HIDE        },
  96.     {"codes",        0,    0,    5,    HT_HIDE        },
  97.     {"distribution",    0,    0,    12,    0        },
  98. #ifdef USETHREADS
  99.     {"date",        0,    0,    4,    HT_MAGIC    },
  100. #else
  101.     {"date",        0,    0,    4,    0        },
  102. #endif
  103.     {"date-received",    0,    0,    13,    0        },
  104.     {"expires",        0,    0,    7,    HT_HIDE|HT_MAGIC},
  105.     {"followup-to",    0,    0,    11,    0        },
  106.     {"from",        0,    0,    4,    HT_MAGIC    },
  107.     {"format",        0,    0,    6,    HT_HIDE        },
  108.     {"keywords",    0,    0,    8,    0        },
  109.     {"lines",        0,    0,    5,    0        },
  110.     {"message-id",    0,    0,    10,    HT_HIDE        },
  111.     {"nf-from",        0,    0,    7,    HT_HIDE        },
  112.     {"nf-id",        0,    0,    5,    HT_HIDE        },
  113.     {"newsgroups",    0,    0,    10,    HT_MAGIC|HT_HIDE},
  114.     {"note",        0,    0,    4,    0,        },
  115.     {"organization",    0,    0,    12,    0        },
  116.     {"path",        0,    0,    4,    HT_HIDE        },
  117.     {"posted",        0,    0,    6,    HT_HIDE        },
  118.     {"posting-version",    0,    0,    15,    HT_HIDE        },
  119.     {"priority",    0,    0,    8,    HT_HIDE        },
  120.     {"reply-to",    0,    0,    8,    HT_HIDE        },
  121.     {"references",    0,    0,    10,    HT_HIDE        },
  122.     {"relay-version",    0,    0,    13,    HT_HIDE        },
  123.     {"sender",        0,    0,    6,    HT_HIDE        },
  124.     {"summary",        0,    0,    7,    0        },
  125.     {"subject",        0,    0,    7,    HT_MAGIC    },
  126.     {"slugword",    0,    0,    8,    HT_HIDE        },
  127.     {"xref",        0,    0,    4,    HT_HIDE        },
  128.     {"x-supersedes",    0,    0,    12,    HT_HIDE        }
  129. };
  130. #endif
  131.  
  132. #ifdef ASYNC_PARSE
  133. EXT ART_NUM parsed_art INIT(0);
  134. #endif
  135.  
  136. EXT char in_header INIT(0);        /* are we decoding the header? */
  137.  
  138. #ifdef CACHESUBJ
  139.     EXT char **subj_list INIT(Null(char **));
  140. #endif
  141.  
  142. void    head_init ANSI((void));
  143. int    set_line_type ANSI((char *,char *));
  144. void    start_header ANSI((ART_NUM));
  145. bool    parseline ANSI((char *,int,int));
  146. #ifdef ASYNC_PARSE
  147.     int        parse_maybe ANSI((ART_NUM));
  148. #endif
  149. char    *fetchsubj ANSI((ART_NUM,bool_int,bool_int));
  150. char    *fetchlines ANSI((ART_NUM,int));
  151.  
  152. #ifdef DEBUGGING
  153. void    dumpheader ANSI((char *));
  154. #endif
  155.