2 /* gperf --struct-type --readonly-table --enum --global -K field_name -N header_entry --ignore-case */
3 /* Contributed by Bruce Lilly
4 derived from http://users.erols.com/blilly/mailparse/fields.gperf */
9 struct header_state { const char *field_name; };
33 Content-Transfer-Encoding
44 Discarded-X400-IPMS-Extensions
45 Discarded-X400-MTS-Extensions
48 Disposition-Notification-Options
49 Disposition-Notification-To
59 Generate-Delivery-Report
83 Original-Encoded-Information-Types
87 Originator-Return-Address
90 Prevent-Nondelivery-Report
112 X400-Content-Identifier
127 my_case_strcmp (s1, s2)
128 register const char *s1;
129 register const char *s2;
133 unsigned char c1 = *s1++;
134 unsigned char c2 = *s2++;
135 if (c1 >= 'A' && c1 <= 'Z')
137 if (c2 >= 'A' && c2 <= 'Z')
139 if (c1 != 0 && c1 == c2)
141 return (int)c1 - (int)c2;
150 int i, j, k, n, exitcode;
152 const struct header_state *hs;
161 for (i = 0; i < n; i++)
163 for (j = 0; j <= MAX_HASH_VALUE; j++)
165 const char *s = wordlist[j].field_name;
169 hs = header_entry (s, len);
170 if (!(hs && strcmp (hs->field_name, s) == 0))
172 fprintf (stderr, "%s != %s\n", s, hs ? hs->field_name : "(null)");
177 for (j = 0; j <= MAX_HASH_VALUE; j++)
179 char s[MAX_WORD_LENGTH+1];
180 /* expensive copy with case conversion (for testing) */
181 strcpy (s, wordlist[j].field_name);
185 for (k = 0; k < len; k++)
186 if (isupper ((unsigned char) s[k]))
187 s[k] = tolower ((unsigned char) s[k]);
188 else if (islower ((unsigned char) s[k]))
189 s[k] = toupper ((unsigned char) s[k]);
190 hs = header_entry (s, len);
191 if (!(hs && my_case_strcmp (hs->field_name, s) == 0))
193 fprintf (stderr, "%s != %s\n", s, hs ? hs->field_name : "(null)");
198 hs = header_entry ("Dave", 4);
201 fprintf (stderr, "Dave == %s\n", hs->field_name);