Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / file / dist / src / names.h
blob783f617ae4d0d232ecc3ae9d8ecaa774400d5fc6
1 /* $NetBSD$ */
3 /*
4 * Copyright (c) Ian F. Darwin 1986-1995.
5 * Software written by Ian F. Darwin and others;
6 * maintained 1995-present by Christos Zoulas and others.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice immediately at the beginning of the file, without modification,
13 * this list of conditions, and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
31 * Names.h - names and types used by ascmagic in file(1).
32 * These tokens are here because they can appear anywhere in
33 * the first HOWMANY bytes, while tokens in MAGIC must
34 * appear at fixed offsets into the file. Don't make HOWMANY
35 * too high unless you have a very fast CPU.
37 * $File: names.h,v 1.32 2008/02/11 00:19:29 rrt Exp $
41 modified by Chris Lowth - 9 April 2000
42 to add mime type strings to the types table.
45 /* these types are used to index the table 'types': keep em in sync! */
46 #define L_C 0 /* first and foremost on UNIX */
47 #define L_CC 1 /* Bjarne's postincrement */
48 #define L_MAKE 2 /* Makefiles */
49 #define L_PLI 3 /* PL/1 */
50 #define L_MACH 4 /* some kinda assembler */
51 #define L_ENG 5 /* English */
52 #define L_PAS 6 /* Pascal */
53 #define L_MAIL 7 /* Electronic mail */
54 #define L_NEWS 8 /* Usenet Netnews */
55 #define L_JAVA 9 /* Java code */
56 #define L_HTML 10 /* HTML */
57 #define L_BCPL 11 /* BCPL */
58 #define L_M4 12 /* M4 */
59 #define L_PO 13 /* PO */
61 static const struct {
62 char human[48];
63 char mime[16];
64 } types[] = {
65 { "C program", "text/x-c", },
66 { "C++ program", "text/x-c++" },
67 { "make commands", "text/x-makefile" },
68 { "PL/1 program", "text/x-pl1" },
69 { "assembler program", "text/x-asm" },
70 { "English", "text/plain" },
71 { "Pascal program", "text/x-pascal" },
72 { "mail", "text/x-mail" },
73 { "news", "text/x-news" },
74 { "Java program", "text/x-java" },
75 { "HTML document", "text/html", },
76 { "BCPL program", "text/x-bcpl" },
77 { "M4 macro language pre-processor", "text/x-m4" },
78 { "PO (gettext message catalogue)", "text/x-po" },
79 { "cannot happen error on names.h/types", "error/x-error" }
83 * XXX - how should we distinguish Java from C++?
84 * The trick used in a Debian snapshot, of having "extends" or "implements"
85 * as tags for Java, doesn't work very well, given that those keywords
86 * are often preceded by "class", which flags it as C++.
88 * Perhaps we need to be able to say
90 * If "class" then
92 * if "extends" or "implements" then
93 * Java
94 * else
95 * C++
96 * endif
98 * Or should we use other keywords, such as "package" or "import"?
99 * Unfortunately, Ada95 uses "package", and Modula-3 uses "import",
100 * although I infer from the language spec at
102 * http://www.research.digital.com/SRC/m3defn/html/m3.html
104 * that Modula-3 uses "IMPORT" rather than "import", i.e. it must be
105 * in all caps.
107 * So, for now, we go with "import". We must put it before the C++
108 * stuff, so that we don't misidentify Java as C++. Not using "package"
109 * means we won't identify stuff that defines a package but imports
110 * nothing; hopefully, very little Java code imports nothing (one of the
111 * reasons for doing OO programming is to import as much as possible
112 * and write only what you need to, right?).
114 * Unfortunately, "import" may cause us to misidentify English text
115 * as Java, as it comes after "the" and "The". Perhaps we need a fancier
116 * heuristic to identify Java?
118 static const struct names {
119 char name[14];
120 short type;
121 } names[] = {
122 /* These must be sorted by eye for optimal hit rate */
123 /* Add to this list only after substantial meditation */
124 {"msgid", L_PO},
125 {"dnl", L_M4},
126 {"import", L_JAVA},
127 {"\"libhdr\"", L_BCPL},
128 {"\"LIBHDR\"", L_BCPL},
129 {"//", L_CC},
130 {"template", L_CC},
131 {"virtual", L_CC},
132 {"class", L_CC},
133 {"public:", L_CC},
134 {"private:", L_CC},
135 {"/*", L_C}, /* must precede "The", "the", etc. */
136 {"#include", L_C},
137 {"char", L_C},
138 {"The", L_ENG},
139 {"the", L_ENG},
140 {"double", L_C},
141 {"extern", L_C},
142 {"float", L_C},
143 {"struct", L_C},
144 {"union", L_C},
145 {"CFLAGS", L_MAKE},
146 {"LDFLAGS", L_MAKE},
147 {"all:", L_MAKE},
148 {".PRECIOUS", L_MAKE},
149 {".ascii", L_MACH},
150 {".asciiz", L_MACH},
151 {".byte", L_MACH},
152 {".even", L_MACH},
153 {".globl", L_MACH},
154 {".text", L_MACH},
155 {"clr", L_MACH},
156 {"(input,", L_PAS},
157 {"program", L_PAS},
158 {"record", L_PAS},
159 {"dcl", L_PLI},
160 {"Received:", L_MAIL},
161 {">From", L_MAIL},
162 {"Return-Path:",L_MAIL},
163 {"Cc:", L_MAIL},
164 {"Newsgroups:", L_NEWS},
165 {"Path:", L_NEWS},
166 {"Organization:",L_NEWS},
167 {"href=", L_HTML},
168 {"HREF=", L_HTML},
169 {"<body", L_HTML},
170 {"<BODY", L_HTML},
171 {"<html", L_HTML},
172 {"<HTML", L_HTML},
173 {"<!--", L_HTML},
175 #define NNAMES (sizeof(names)/sizeof(struct names))