1# Copyright (c) 1988 The Regents of the University of California. 2# All rights reserved. 3# 4# This code is derived from software contributed to Berkeley by 5# Kenneth Almquist. 6# 7# %sccs.include.redist.sh% 8# 9# @(#)mkops 1.3 (Berkeley) 06/03/92 10# 11 12 13exec > operators.h 14awk '/^[^#]/ {printf "#define %s %d\n", $1, n++}' unary_op binary_op 15awk '/^[^#]/ {n++} 16END {printf "\n#define FIRST_BINARY_OP %d\n", n} 17' unary_op 18echo ' 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 23extern char *const unary_op[]; 24extern char *const binary_op[]; 25extern const char op_priority[]; 26extern const char op_argflag[];' 27 28exec > operators.c 29echo '/* 30 * Operators used in the test command. 31 */ 32 33#include <stdio.h> 34#include "operators.h" 35 36char *const unary_op[] = {' 37awk '/^[^#]/ {printf " \"%s\",\n", $2}' unary_op 38echo ' NULL 39}; 40 41char *const binary_op[] = {' 42awk '/^[^#]/ {printf " \"%s\",\n", $2}' binary_op 43echo ' NULL 44}; 45 46const char op_priority[] = {' 47awk '/^[^#]/ {printf " %s,\n", $3}' unary_op binary_op 48echo '}; 49 50const char op_argflag[] = {' 51awk '/^[^#]/ {if (length($4) > 0) printf " %s,\n", $4 52 else printf " 0,\n"} 53' unary_op binary_op 54echo '};' 55