1
by Nathaniel McCallum
Import upstream version 4.0.2 |
1 |
#! /bin/sh
|
2 |
||
3 |
if test -z "$AWK"; then |
|
4 |
AWK=awk |
|
5 |
fi
|
|
6 |
if test -z "$CC"; then |
|
7 |
CC=cc |
|
8 |
fi
|
|
9 |
if test -z "$srcdir"; then |
|
10 |
srcdir=. |
|
11 |
fi
|
|
12 |
||
13 |
LC_ALL=C |
|
14 |
export LC_ALL
|
|
15 |
||
16 |
rm -f comm.h |
|
17 |
cat << EOF > comm.h
|
|
18 |
/*
|
|
19 |
* This file is automagically created from comm.c -- DO NOT EDIT
|
|
20 |
*/
|
|
21 |
||
22 |
struct comm
|
|
23 |
{
|
|
24 |
char *name;
|
|
25 |
int flags;
|
|
26 |
#ifdef MULTIUSER
|
|
27 |
AclBits userbits[ACL_BITS_PER_CMD];
|
|
28 |
#endif
|
|
29 |
};
|
|
30 |
||
31 |
#define ARGS_MASK (3)
|
|
32 |
||
33 |
#define ARGS_0 (0)
|
|
34 |
#define ARGS_1 (1)
|
|
35 |
#define ARGS_2 (2)
|
|
36 |
#define ARGS_3 (3)
|
|
37 |
||
38 |
#define ARGS_PLUS1 (1<<2)
|
|
39 |
#define ARGS_PLUS2 (1<<3)
|
|
40 |
#define ARGS_PLUS3 (1<<4)
|
|
41 |
#define ARGS_ORMORE (1<<5)
|
|
42 |
||
43 |
#define NEED_FORE (1<<6) /* this command needs a fore window */
|
|
44 |
#define NEED_DISPLAY (1<<7) /* this command needs a display */
|
|
45 |
#define NEED_LAYER (1<<8) /* this command needs a layer */
|
|
46 |
||
47 |
#define ARGS_01 (ARGS_0 | ARGS_PLUS1)
|
|
48 |
#define ARGS_02 (ARGS_0 | ARGS_PLUS2)
|
|
49 |
#define ARGS_12 (ARGS_1 | ARGS_PLUS1)
|
|
50 |
#define ARGS_23 (ARGS_2 | ARGS_PLUS1)
|
|
51 |
#define ARGS_24 (ARGS_2 | ARGS_PLUS2)
|
|
52 |
#define ARGS_34 (ARGS_3 | ARGS_PLUS1)
|
|
53 |
#define ARGS_012 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2)
|
|
54 |
#define ARGS_0123 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
|
|
55 |
#define ARGS_123 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2)
|
|
56 |
#define ARGS_124 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS3)
|
|
57 |
#define ARGS_1234 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
|
|
58 |
||
59 |
struct action
|
|
60 |
{
|
|
61 |
int nr;
|
|
62 |
char **args;
|
|
63 |
int *argl;
|
|
64 |
};
|
|
65 |
||
66 |
#define RC_ILLEGAL -1
|
|
67 |
||
68 |
EOF
|
|
69 |
$AWK < ${srcdir}/comm.c >> comm.h ' |
|
70 |
/^ [{] ".*/ { if (old > $2) {
|
|
71 |
printf("***ERROR: %s <= %s !!!\n\n", $2, old);
|
|
72 |
exit 1;
|
|
73 |
}
|
|
74 |
old = $2;
|
|
75 |
}
|
|
76 |
'
|
|
77 |
$CC -E -I. -I${srcdir} ${srcdir}/comm.c > comm.cpp |
|
78 |
sed < comm.cpp \
|
|
79 |
-n \
|
|
80 |
-e '/^ *{ "/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ |
|
81 |
-e '/^ *{ "/s/^ *{ "\([^"]*\)".*/\1/p' \ |
|
82 |
| $AWK ' |
|
83 |
/.*/ { printf "#define RC_%s %d\n",$0,i++;
|
|
84 |
}
|
|
85 |
END { printf "\n#define RC_LAST %d\n",i-1;
|
|
86 |
}
|
|
87 |
' >> comm.h
|
|
88 |
chmod a-w comm.h |
|
89 |
rm -f comm.cpp |