Annotation of src/usr.bin/file/names.h, Revision 1.4
1.4 ! ian 1: /* $OpenBSD: names.h,v 1.3 1997/02/09 23:58:29 millert Exp $ */
1.3 millert 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: *
1.4 ! ian 10: * Copyright (c) Ian F. Darwin 1986-1995.
! 11: * Software written by Ian F. Darwin and others;
! 12: * maintained 1995-present by Christos Zoulas and others.
! 13: *
! 14: * Redistribution and use in source and binary forms, with or without
! 15: * modification, are permitted provided that the following conditions
! 16: * are met:
! 17: * 1. Redistributions of source code must retain the above copyright
! 18: * notice immediately at the beginning of the file, without modification,
! 19: * this list of conditions, and the following disclaimer.
! 20: * 2. Redistributions in binary form must reproduce the above copyright
! 21: * notice, this list of conditions and the following disclaimer in the
! 22: * documentation and/or other materials provided with the distribution.
! 23: * 3. All advertising materials mentioning features or use of this software
! 24: * must display the following acknowledgement:
! 25: * This product includes software developed by Ian F. Darwin and others.
! 26: * 4. The name of the author may not be used to endorse or promote products
! 27: * derived from this software without specific prior written permission.
! 28: *
! 29: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
! 30: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 31: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 32: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
! 33: * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 34: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 35: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 36: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 37: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 38: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 39: * SUCH DAMAGE.
1.1 deraadt 40: */
41:
42: /* these types are used to index the table 'types': keep em in sync! */
43: #define L_C 0 /* first and foremost on UNIX */
1.3 millert 44: #define L_CC 1 /* Bjarne's postincrement */
45: #define L_FORT 2 /* the oldest one */
46: #define L_MAKE 3 /* Makefiles */
47: #define L_PLI 4 /* PL/1 */
48: #define L_MACH 5 /* some kinda assembler */
49: #define L_ENG 6 /* English */
50: #define L_PAS 7 /* Pascal */
51: #define L_MAIL 8 /* Electronic mail */
52: #define L_NEWS 9 /* Usenet Netnews */
1.1 deraadt 53:
54: static char *types[] = {
55: "C program text",
1.3 millert 56: "C++ program text",
1.1 deraadt 57: "FORTRAN program text",
58: "make commands text" ,
59: "PL/1 program text",
60: "assembler program text",
61: "English text",
62: "Pascal program text",
63: "mail text",
64: "news text",
65: "can't happen error on names.h/types",
66: 0};
67:
68: static struct names {
69: char *name;
70: short type;
71: } names[] = {
72: /* These must be sorted by eye for optimal hit rate */
73: /* Add to this list only after substantial meditation */
1.3 millert 74: {"//", L_CC},
75: {"template", L_CC},
76: {"virtual", L_CC},
77: {"class", L_CC},
78: {"public:", L_CC},
79: {"private:", L_CC},
1.1 deraadt 80: {"/*", L_C}, /* must precede "The", "the", etc. */
81: {"#include", L_C},
82: {"char", L_C},
83: {"The", L_ENG},
84: {"the", L_ENG},
85: {"double", L_C},
86: {"extern", L_C},
87: {"float", L_C},
88: {"real", L_C},
89: {"struct", L_C},
90: {"union", L_C},
91: {"CFLAGS", L_MAKE},
92: {"LDFLAGS", L_MAKE},
93: {"all:", L_MAKE},
94: {".PRECIOUS", L_MAKE},
95: /* Too many files of text have these words in them. Find another way
96: * to recognize Fortrash.
97: */
98: #ifdef NOTDEF
99: {"subroutine", L_FORT},
100: {"function", L_FORT},
101: {"block", L_FORT},
102: {"common", L_FORT},
103: {"dimension", L_FORT},
104: {"integer", L_FORT},
105: {"data", L_FORT},
106: #endif /*NOTDEF*/
107: {".ascii", L_MACH},
108: {".asciiz", L_MACH},
109: {".byte", L_MACH},
110: {".even", L_MACH},
111: {".globl", L_MACH},
112: {".text", L_MACH},
113: {"clr", L_MACH},
114: {"(input,", L_PAS},
115: {"dcl", L_PLI},
116: {"Received:", L_MAIL},
117: {">From", L_MAIL},
118: {"Return-Path:",L_MAIL},
119: {"Cc:", L_MAIL},
120: {"Newsgroups:", L_NEWS},
121: {"Path:", L_NEWS},
122: {"Organization:",L_NEWS},
123: {NULL, 0}
124: };
125: #define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)