1 | # Copyright 1989 by Kenneth Almquist. All rights reserved.
|
---|
2 | #
|
---|
3 | # This file is part of ash. Ash is distributed under the terms specified
|
---|
4 | # by the Ash General Public License. See the file named LICENSE.
|
---|
5 |
|
---|
6 | # All calls to awk removed, because Minix bawk is deficient. (kjb)
|
---|
7 |
|
---|
8 | exec > operators.h
|
---|
9 | i=0
|
---|
10 | sed -e '/^[^#]/!d' unary_op binary_op | while read line
|
---|
11 | do
|
---|
12 | set -$- $line
|
---|
13 | echo "#define $1 $i"
|
---|
14 | i=`expr $i + 1`
|
---|
15 | done
|
---|
16 | echo
|
---|
17 | echo "#define FIRST_BINARY_OP" `sed -e '/^[^#]/!d' unary_op | wc -l`
|
---|
18 | echo '
|
---|
19 | #define OP_INT 1 /* arguments to operator are integer */
|
---|
20 | #define OP_STRING 2 /* arguments to operator are string */
|
---|
21 | #define OP_FILE 3 /* argument is a file name */
|
---|
22 | #define OP_LFILE 4 /* argument is a file name of a symlink? */
|
---|
23 |
|
---|
24 | extern char *const unary_op[];
|
---|
25 | extern char *const binary_op[];
|
---|
26 | extern const char op_priority[];
|
---|
27 | extern const char op_argflag[];'
|
---|
28 |
|
---|
29 | exec > operators.c
|
---|
30 | echo '/*
|
---|
31 | * Operators used in the expr/test command.
|
---|
32 | */
|
---|
33 |
|
---|
34 | #include "../shell.h"
|
---|
35 | #include "operators.h"
|
---|
36 |
|
---|
37 | char *const unary_op[] = {'
|
---|
38 | sed -e '/^[^#]/!d
|
---|
39 | s/[ ][ ]*/ /g
|
---|
40 | s/^[^ ][^ ]* \([^ ][^ ]*\).*/ "\1",/
|
---|
41 | ' unary_op
|
---|
42 | echo ' NULL
|
---|
43 | };
|
---|
44 |
|
---|
45 | char *const binary_op[] = {'
|
---|
46 | sed -e '/^[^#]/!d
|
---|
47 | s/[ ][ ]*/ /g
|
---|
48 | s/^[^ ][^ ]* \([^ ][^ ]*\).*/ "\1",/
|
---|
49 | ' binary_op
|
---|
50 | echo ' NULL
|
---|
51 | };
|
---|
52 |
|
---|
53 | const char op_priority[] = {'
|
---|
54 | sed -e '/^[^#]/!d
|
---|
55 | s/[ ][ ]*/ /g
|
---|
56 | s/^[^ ][^ ]* [^ ][^ ]* \([^ ][^ ]*\).*/ \1,/
|
---|
57 | ' unary_op binary_op
|
---|
58 | echo '};
|
---|
59 |
|
---|
60 | const char op_argflag[] = {'
|
---|
61 | sed -e '/^[^#]/!d
|
---|
62 | s/[ ][ ]*/ /g
|
---|
63 | s/^[^ ][^ ]* [^ ][^ ]* [^ ][^ ]*$/& 0/
|
---|
64 | s/^[^ ][^ ]* [^ ][^ ]* [^ ][^ ]* \([^ ][^ ]*\)/ \1,/
|
---|
65 | ' unary_op binary_op
|
---|
66 | echo '};'
|
---|