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