home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / trn_12.zip / src / head.h < prev    next >
C/C++ Source or Header  |  1993-12-04  |  5KB  |  158 lines

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