xref: /original-bsd/bin/test/operators.c (revision 3413c235)
1 /*-
2  * Copyright (c) 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)operators.c	8.2 (Berkeley) 04/01/94";
10 #endif /* not lint */
11 
12 /*
13  * Operators used in the test command.
14  */
15 
16 #include <stdio.h>
17 
18 #include "operators.h"
19 
20 const char *const unary_op[] = {
21       "!",
22       "-b",
23       "-c",
24       "-d",
25       "-e",
26       "-f",
27       "-g",
28       "-h",
29       "-k",
30       "-n",
31       "-p",
32       "-r",
33       "-s",
34       "-t",
35       "-u",
36       "-w",
37       "-x",
38       "-z",
39       NULL
40 };
41 
42 const char *const binary_op[] = {
43       "-o",
44       "|",
45       "-a",
46       "&",
47       "=",
48       "!=",
49       "-eq",
50       "-ne",
51       "-gt",
52       "-lt",
53       "-le",
54       "-ge",
55       NULL
56 };
57 
58 const char op_priority[] = {
59       3,
60       12,
61       12,
62       12,
63       12,
64       12,
65       12,
66       12,
67       12,
68       12,
69       12,
70       12,
71       12,
72       12,
73       12,
74       12,
75       12,
76       12,
77       1,
78       1,
79       2,
80       2,
81       4,
82       4,
83       4,
84       4,
85       4,
86       4,
87       4,
88       4,
89 };
90 
91 const char op_argflag[] = {
92       0,
93       OP_FILE,
94       OP_FILE,
95       OP_FILE,
96       OP_FILE,
97       OP_FILE,
98       OP_FILE,
99       OP_FILE,
100       OP_FILE,
101       OP_STRING,
102       OP_FILE,
103       OP_FILE,
104       OP_FILE,
105       OP_INT,
106       OP_FILE,
107       OP_FILE,
108       OP_FILE,
109       OP_STRING,
110       0,
111       0,
112       0,
113       0,
114       OP_STRING,
115       OP_STRING,
116       OP_INT,
117       OP_INT,
118       OP_INT,
119       OP_INT,
120       OP_INT,
121       OP_INT,
122 };
123