fixed bug making 2dd screw up on vt100's with "set number".
[unix-history] / usr / src / usr.bin / ex / makeoptions
CommitLineData
a3c4d8d0
MH
1#
2# remake options -- this isn't necessary unless you add/delete options
3#
d266c416
MH
4onintr ifintr
5cp ex_data.c /tmp/$$.c
6ex - /tmp/$$.c <<'%'
7 g/^#include/d
8 w
9 q
a3c4d8d0 10'%'
d266c416
MH
11cc -E $* /tmp/$$.c >/tmp/foo.c
12ex - /tmp/foo.c <<'X'
13 " delete all preprocessor output (# line, etc)
14 g/^# /d
15 set sh=/bin/csh
16 " delete junk (all but data lines)
17 g/^[ ]*$/d
04379bab 18 1,/option options/d
d266c416
MH
19 /}/-1,$d
20 " get rid of all of line but option name
21 1,$s/ "//
22 1,$s/".*//
23 1m$ " kludge since options start at 0 but num at 1
24 %!num
25 $t0 " unkludge
26 1s/......../ 0 / " unkludge
27 " make #define lines
28 1,$s/\(......\)\(.*\)/#define \U\2\L \1/
29 " get rid of extra blanks, turning into (single) tabs.
30 1,$s/ */ /g
31 g/ */s// /g
32 " filter through expand to make it line up nice
33 %!expand -8\,24
34 " blank line and number of options.
35 $i
a3c4d8d0
MH
36
37.
d266c416 38 $s/e[ ].*[ ]/e NOPTS /
7c4625ef 39 0a
04379bab 40 /* sccs id @(#) ex_vars.h @(#)makeoptions 6.1 %G% */
7c4625ef 41.
d266c416
MH
42 w! ex_vars.h
43 q
a3c4d8d0
MH
44'X'
45ifintr:
d266c416 46rm /tmp/foo.c