pci: don't do sanity check for missing pci bus, the check can misfire.
[minix.git] / commands / ash / bltin / mkexpr
blob7b7397f9c57787ea7c1ac9a82e28e108bf19fdde
1 # Copyright 1989 by Kenneth Almquist.  All rights reserved.
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.
6 # All calls to awk removed, because Minix bawk is deficient.  (kjb)
8 if [ $# -ne 2 ]
9 then
10         echo "Usage: $0 <unary_op> <binary_op>" >&2
11         exit 1
13 unary_op="$1"
14 binary_op="$2"
16 exec > operators.h
17 i=0
18 sed -e '/^[^#]/!d' "$unary_op" "$binary_op" | while read line
20         set -$- $line
21         echo "#define $1 $i"
22         i=`expr $i + 1`
23 done
24 echo
25 echo "#define FIRST_BINARY_OP" `sed -e '/^[^#]/!d' "$unary_op" | wc -l`
26 echo '
27 #define OP_INT 1                /* arguments to operator are integer */
28 #define OP_STRING 2             /* arguments to operator are string */
29 #define OP_FILE 3               /* argument is a file name */
31 extern char *const unary_op[];
32 extern char *const binary_op[];
33 extern const char op_priority[];
34 extern const char op_argflag[];'
36 exec > operators.c
37 echo '/*
38  * Operators used in the expr/test command.
39  */
41 #include <stddef.h>
42 #include "shell.h"
43 #include "operators.h"
45 char *const unary_op[] = {'
46 sed -e '/^[^#]/!d
47         s/[     ][      ]*/ /g
48         s/^[^ ][^ ]* \([^ ][^ ]*\).*/      "\1",/
49         ' "$unary_op"
50 echo '      NULL
53 char *const binary_op[] = {'
54 sed -e '/^[^#]/!d
55         s/[     ][      ]*/ /g
56         s/^[^ ][^ ]* \([^ ][^ ]*\).*/      "\1",/
57         ' "$binary_op"
58 echo '      NULL
61 const char op_priority[] = {'
62 sed -e '/^[^#]/!d
63         s/[     ][      ]*/ /g
64         s/^[^ ][^ ]* [^ ][^ ]* \([^ ][^ ]*\).*/      \1,/
65         ' "$unary_op" "$binary_op"
66 echo '};
68 const char op_argflag[] = {'
69 sed -e '/^[^#]/!d
70         s/[     ][      ]*/ /g
71         s/^[^ ][^ ]* [^ ][^ ]* [^ ][^ ]*$/& 0/
72         s/^[^ ][^ ]* [^ ][^ ]* [^ ][^ ]* \([^ ][^ ]*\)/      \1,/
73         ' "$unary_op" "$binary_op"
74 echo '};'