Commit | Line | Data |
---|---|---|
edf71f48 DF |
1 | # |
2 | # Copyright (c) 1980 Regents of the University of California. | |
3 | # All rights reserved. The Berkeley software License Agreement | |
4 | # specifies the terms and conditions for redistribution. | |
5 | # | |
6 | # @(#)makeoptions 6.4 (Berkeley) %G% | |
7 | # | |
f2c7971f | 8 | |
a3c4d8d0 MH |
9 | # |
10 | # remake options -- this isn't necessary unless you add/delete options | |
11 | # | |
d266c416 | 12 | onintr ifintr |
dea1c496 | 13 | cat < ex_data.c > /tmp/$$.c |
d266c416 MH |
14 | ex - /tmp/$$.c <<'%' |
15 | g/^#include/d | |
16 | w | |
17 | q | |
a3c4d8d0 | 18 | '%' |
d266c416 MH |
19 | cc -E $* /tmp/$$.c >/tmp/foo.c |
20 | ex - /tmp/foo.c <<'X' | |
21 | " delete all preprocessor output (# line, etc) | |
22 | g/^# /d | |
23 | set sh=/bin/csh | |
24 | " delete junk (all but data lines) | |
25 | g/^[ ]*$/d | |
04379bab | 26 | 1,/option options/d |
d266c416 MH |
27 | /}/-1,$d |
28 | " get rid of all of line but option name | |
f2c7971f | 29 | 1,$s/[ ]*"// |
d266c416 | 30 | 1,$s/".*// |
f2c7971f PK |
31 | " begin kludge since options start at 0 but cat -n starts at 1 |
32 | " move first to end and later move it back and renumber | |
33 | 1m$ | |
34 | %!cat -n | |
35 | $t0 | |
36 | 1s/[0-9][0-9]*/0/ | |
37 | " end kludge | |
d266c416 | 38 | " make #define lines |
f2c7971f | 39 | 1,$s/[ ]*\([0-9][0-9]*\)[ ]*\(.*\)/#define \U\2\L \1/ |
d266c416 MH |
40 | " filter through expand to make it line up nice |
41 | %!expand -8\,24 | |
42 | " blank line and number of options. | |
43 | $i | |
a3c4d8d0 MH |
44 | |
45 | . | |
d266c416 | 46 | $s/e[ ].*[ ]/e NOPTS / |
7c4625ef | 47 | 0a |
edf71f48 | 48 | /* sccs id @(#) ex_vars.h @(#)makeoptions 6.4 %G% */ |
7c4625ef | 49 | . |
d266c416 MH |
50 | w! ex_vars.h |
51 | q | |
a3c4d8d0 MH |
52 | 'X' |
53 | ifintr: | |
d266c416 | 54 | rm /tmp/foo.c |