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