xref: /386bsd/usr/src/usr.bin/file/names.h (revision a2142627)
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  * This software is not subject to any license of the American Telephone
12  * and Telegraph Company or of the Regents of the University of California.
13  *
14  * Permission is granted to anyone to use this software for any purpose on
15  * any computer system, and to alter it and redistribute it freely, subject
16  * to the terms in the accompanying LEGAL.NOTICE file.
17  */
18 
19 /* these types are used to index the table 'types': keep em in sync! */
20 #define L_C	0		/* first and foremost on UNIX */
21 #define	L_FORT	1		/* the oldest one */
22 #define L_MAKE	2		/* Makefiles */
23 #define L_PLI	3		/* PL/1 */
24 #define L_MACH	4		/* some kinda assembler */
25 #define L_ENG	5		/* English */
26 #define	L_PAS	6		/* Pascal */
27 #define	L_MAIL	7		/* Electronic mail */
28 #define	L_NEWS	8		/* Usenet Netnews */
29 
30 char *types[] = {
31 	"c program text",
32 	"fortran program text",
33 	"make commands text" ,
34 	"pl/1 program text",
35 	"assembler program text",
36 	"English text",
37 	"pascal program text",
38 	"mail text",
39 	"news text",
40 	"can't happen error on names.h/types",
41 	0};
42 
43 struct names {
44 	char *name;
45 	short type;
46 } names[] = {
47 	/* These must be sorted by eye for optimal hit rate */
48 	/* Add to this list only after substantial meditation */
49 	{"/*",		L_C},	/* must preced "The", "the", etc. */
50 	{"#include",	L_C},
51 	{"char",	L_C},
52 	{"The",		L_ENG},
53 	{"the",		L_ENG},
54 	{"double",	L_C},
55 	{"extern",	L_C},
56 	{"float",	L_C},
57 	{"real",	L_C},
58 	{"struct",	L_C},
59 	{"union",	L_C},
60 	{"CFLAGS",	L_MAKE},
61 	{"LDFLAGS",	L_MAKE},
62 	{"all:",	L_MAKE},
63 	{".PRECIOUS",	L_MAKE},
64 /* Too many files of text have these words in them.  Find another way
65  * to recognize Fortrash.
66  */
67 #ifdef	NOTDEF
68 	{"subroutine",	L_FORT},
69 	{"function",	L_FORT},
70 	{"block",	L_FORT},
71 	{"common",	L_FORT},
72 	{"dimension",	L_FORT},
73 	{"integer",	L_FORT},
74 	{"data",	L_FORT},
75 #endif	/*NOTDEF*/
76 	{".ascii",	L_MACH},
77 	{".asciiz",	L_MACH},
78 	{".byte",	L_MACH},
79 	{".even",	L_MACH},
80 	{".globl",	L_MACH},
81 	{"clr",		L_MACH},
82 	{"(input,",	L_PAS},
83 	{"dcl",		L_PLI},
84 	{"Received:",	L_MAIL},
85 	{">From",	L_MAIL},
86 	{"Return-Path:",L_MAIL},
87 	{"Cc:",		L_MAIL},
88 	{"Newsgroups:",	L_NEWS},
89 	{"Path:",	L_NEWS},
90 	{"Organization:",L_NEWS},
91 	0};
92 #define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)
93