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