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