Annotation of src/usr.bin/file/names.h, Revision 1.1.1.1
1.1 deraadt 1: /*
2: * Names.h - names and types used by ascmagic in file(1).
3: * These tokens are here because they can appear anywhere in
4: * the first HOWMANY bytes, while tokens in /etc/magic must
5: * appear at fixed offsets into the file. Don't make HOWMANY
6: * too high unless you have a very fast CPU.
7: *
8: * Copyright (c) Ian F. Darwin, 1987.
9: * Written by Ian F. Darwin.
10: *
11: * See LEGAL.NOTICE
12: *
13: * $Id: names.h,v 1.4 1995/04/28 19:23:56 christos Exp $
14: */
15:
16: /* these types are used to index the table 'types': keep em in sync! */
17: #define L_C 0 /* first and foremost on UNIX */
18: #define L_FORT 1 /* the oldest one */
19: #define L_MAKE 2 /* Makefiles */
20: #define L_PLI 3 /* PL/1 */
21: #define L_MACH 4 /* some kinda assembler */
22: #define L_ENG 5 /* English */
23: #define L_PAS 6 /* Pascal */
24: #define L_MAIL 7 /* Electronic mail */
25: #define L_NEWS 8 /* Usenet Netnews */
26:
27: static char *types[] = {
28: "C program text",
29: "FORTRAN program text",
30: "make commands text" ,
31: "PL/1 program text",
32: "assembler program text",
33: "English text",
34: "Pascal program text",
35: "mail text",
36: "news text",
37: "can't happen error on names.h/types",
38: 0};
39:
40: static struct names {
41: char *name;
42: short type;
43: } names[] = {
44: /* These must be sorted by eye for optimal hit rate */
45: /* Add to this list only after substantial meditation */
46: {"/*", L_C}, /* must precede "The", "the", etc. */
47: {"#include", L_C},
48: {"char", L_C},
49: {"The", L_ENG},
50: {"the", L_ENG},
51: {"double", L_C},
52: {"extern", L_C},
53: {"float", L_C},
54: {"real", L_C},
55: {"struct", L_C},
56: {"union", L_C},
57: {"CFLAGS", L_MAKE},
58: {"LDFLAGS", L_MAKE},
59: {"all:", L_MAKE},
60: {".PRECIOUS", L_MAKE},
61: /* Too many files of text have these words in them. Find another way
62: * to recognize Fortrash.
63: */
64: #ifdef NOTDEF
65: {"subroutine", L_FORT},
66: {"function", L_FORT},
67: {"block", L_FORT},
68: {"common", L_FORT},
69: {"dimension", L_FORT},
70: {"integer", L_FORT},
71: {"data", L_FORT},
72: #endif /*NOTDEF*/
73: {".ascii", L_MACH},
74: {".asciiz", L_MACH},
75: {".byte", L_MACH},
76: {".even", L_MACH},
77: {".globl", L_MACH},
78: {".text", L_MACH},
79: {"clr", L_MACH},
80: {"(input,", L_PAS},
81: {"dcl", L_PLI},
82: {"Received:", L_MAIL},
83: {">From", L_MAIL},
84: {"Return-Path:",L_MAIL},
85: {"Cc:", L_MAIL},
86: {"Newsgroups:", L_NEWS},
87: {"Path:", L_NEWS},
88: {"Organization:",L_NEWS},
89: {NULL, 0}
90: };
91: #define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)