[PATCH] Screen buffers ESC keypresses indefinitely since sgr support
[screen.git] / src / comm.sh
blob5bae17f8d2bf7852a111cccbede1bea05d773842
1 #! /bin/sh
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=.
13 LC_ALL=C
14 export LC_ALL
16 rm -f comm.h
17 cat << EOF > comm.h
19 * This file is automagically created from comm.c -- DO NOT EDIT
22 #ifndef SCREEN_COMM_H
23 #define SCREEN_COMM_H
25 #include "acls.h"
27 struct comm
29 char *name;
30 int flags;
31 AclBits userbits[ACL_BITS_PER_CMD];
34 extern struct comm comms[];
36 #define ARGS_MASK (3)
38 #define ARGS_0 (0)
39 #define ARGS_1 (1)
40 #define ARGS_2 (2)
41 #define ARGS_3 (3)
43 #define ARGS_PLUS1 (1<<2)
44 #define ARGS_PLUS2 (1<<3)
45 #define ARGS_PLUS3 (1<<4)
46 #define ARGS_ORMORE (1<<5)
48 #define NEED_FORE (1<<6) /* this command needs a fore window */
49 #define NEED_DISPLAY (1<<7) /* this command needs a display */
50 #define NEED_LAYER (1<<8) /* this command needs a layer */
51 #define CAN_QUERY (1<<9) /* this command can be queried, i.e. used with -Q to
52 get back a result to stdout */
54 #define ARGS_01 (ARGS_0 | ARGS_PLUS1)
55 #define ARGS_02 (ARGS_0 | ARGS_PLUS2)
56 #define ARGS_12 (ARGS_1 | ARGS_PLUS1)
57 #define ARGS_23 (ARGS_2 | ARGS_PLUS1)
58 #define ARGS_24 (ARGS_2 | ARGS_PLUS2)
59 #define ARGS_34 (ARGS_3 | ARGS_PLUS1)
60 #define ARGS_012 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2)
61 #define ARGS_0123 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
62 #define ARGS_123 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2)
63 #define ARGS_124 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS3)
64 #define ARGS_1234 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
66 struct action
68 int nr;
69 char **args;
70 int *argl;
71 int quiet; /* Suppress (currently unused)
72 0x01 - Error message
73 0x02 - Normal message
77 #define RC_ILLEGAL -1
79 #endif /* SCREEN_COMM_H */
81 EOF
82 $AWK < ${srcdir}/comm.c >> comm.h '
83 /^ [{] ".*/ { if (old > $2) {
84 printf("***ERROR: %s <= %s !!!\n\n", $2, old);
85 exit 1;
87 old = $2;
91 $CC -E -I. -I${srcdir} ${srcdir}/comm.c > comm.cpp || exit $?
92 sed < comm.cpp \
93 -n \
94 -e '/^ *{ "/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
95 -e '/^ *{ "/s/^ *{ "\([^"]*\)".*/\1/p' \
96 | $AWK '
97 /.*/ { printf "#define RC_%s %d\n",$0,i++;
99 END { printf "\n#define RC_LAST %d\n",i-1;
101 ' >> comm.h
102 chmod a-w comm.h
103 rm -f comm.cpp