xref: /original-bsd/bin/test/operators.c (revision 2a092256)
1 /*-
2  * Copyright (c) 1993 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)operators.c	5.1 (Berkeley) 04/30/93";
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 char *const unary_op[] = {
21       "!",
22       "-b",
23       "-c",
24       "-d",
25       "-e",
26       "-f",
27       "-g",
28       "-k",
29       "-n",
30       "-p",
31       "-r",
32       "-s",
33       "-t",
34       "-u",
35       "-w",
36       "-x",
37       "-z",
38       NULL
39 };
40 
41 char *const binary_op[] = {
42       "-o",
43       "|",
44       "-a",
45       "&",
46       "=",
47       "!=",
48       "-eq",
49       "-ne",
50       "-gt",
51       "-lt",
52       "-le",
53       "-ge",
54       NULL
55 };
56 
57 const char op_priority[] = {
58       3,
59       12,
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       1,
76       1,
77       2,
78       2,
79       4,
80       4,
81       4,
82       4,
83       4,
84       4,
85       4,
86       4,
87 };
88 
89 const char op_argflag[] = {
90       0,
91       OP_FILE,
92       OP_FILE,
93       OP_FILE,
94       OP_FILE,
95       OP_FILE,
96       OP_FILE,
97       OP_FILE,
98       OP_STRING,
99       OP_FILE,
100       OP_FILE,
101       OP_FILE,
102       OP_INT,
103       OP_FILE,
104       OP_FILE,
105       OP_FILE,
106       OP_STRING,
107       0,
108       0,
109       0,
110       0,
111       OP_STRING,
112       OP_STRING,
113       OP_INT,
114       OP_INT,
115       OP_INT,
116       OP_INT,
117       OP_INT,
118       OP_INT,
119 };
120