xref: /csrg-svn/usr.bin/ex/makeoptions (revision 16400)
1*16400Speter
2465Smark#
3465Smark# remake options -- this isn't necessary unless you add/delete options
4465Smark#
5535Smarkonintr ifintr
6535Smarkcp ex_data.c /tmp/$$.c
7535Smarkex - /tmp/$$.c <<'%'
8535Smark	g/^#include/d
9535Smark	w
10535Smark	q
11465Smark'%'
12535Smarkcc -E $* /tmp/$$.c >/tmp/foo.c
13535Smarkex - /tmp/foo.c <<'X'
14535Smark	" delete all preprocessor output (# line, etc)
15535Smark	g/^# /d
16535Smark	set sh=/bin/csh
17535Smark	" delete junk (all but data lines)
18535Smark	g/^[ 	]*$/d
191540Smark	1,/option options/d
20535Smark	/}/-1,$d
21535Smark	" get rid of all of line but option name
22*16400Speter	1,$s/[ 	]*"//
23535Smark	1,$s/".*//
24*16400Speter	" begin kludge since options start at 0 but cat -n starts at 1
25*16400Speter	"              move first to end and later move it back and renumber
26*16400Speter	1m$
27*16400Speter	%!cat -n
28*16400Speter	$t0
29*16400Speter	1s/[0-9][0-9]*/0/
30*16400Speter	" end kludge
31535Smark	" make #define lines
32*16400Speter	1,$s/[ 	]*\([0-9][0-9]*\)[ 	]*\(.*\)/#define	\U\2\L	\1/
33535Smark	" filter through expand to make it line up nice
34535Smark	%!expand -8\,24
35535Smark	" blank line and number of options.
36535Smark	$i
37465Smark
38465Smark.
39535Smark	$s/e[ 	].*[ 	]/e	NOPTS	/
40558Smark	0a
41*16400Speter	/*  sccs id   @(#)  ex_vars.h  @(#)makeoptions	6.2 04/17/84  */
42558Smark.
43535Smark	w! ex_vars.h
44535Smark	q
45465Smark'X'
46465Smarkifintr:
47535Smarkrm /tmp/foo.c
48