xref: /csrg-svn/usr.bin/ex/makeoptions (revision 558)
1465Smark#
2465Smark# remake options -- this isn't necessary unless you add/delete options
3465Smark#
4535Smarkonintr ifintr
5535Smarkcp ex_data.c /tmp/$$.c
6535Smarkex - /tmp/$$.c <<'%'
7535Smark	g/^#include/d
8535Smark	w
9535Smark	q
10465Smark'%'
11535Smarkcc -E $* /tmp/$$.c >/tmp/foo.c
12535Smarkex - /tmp/foo.c <<'X'
13535Smark	" delete all preprocessor output (# line, etc)
14535Smark	g/^# /d
15535Smark	set sh=/bin/csh
16535Smark	" delete junk (all but data lines)
17535Smark	g/^[ 	]*$/d
18535Smark	1,/options/d
19535Smark	/}/-1,$d
20535Smark	" get rid of all of line but option name
21535Smark	1,$s/	"//
22535Smark	1,$s/".*//
23535Smark	1m$	" kludge since options start at 0 but num at 1
24535Smark	%!num
25535Smark	$t0	" unkludge
26535Smark	1s/......../     0  /	" unkludge
27535Smark	" make #define lines
28535Smark	1,$s/\(......\)\(.*\)/#define	\U\2\L	\1/
29535Smark	" get rid of extra blanks, turning into (single) tabs.
30535Smark	1,$s/	 */	/g
31535Smark	g/  */s//	/g
32535Smark	" filter through expand to make it line up nice
33535Smark	%!expand -8\,24
34535Smark	" blank line and number of options.
35535Smark	$i
36465Smark
37465Smark.
38535Smark	$s/e[ 	].*[ 	]/e	NOPTS	/
39*558Smark	0a
40*558Smark	/*  sccs id   @(#)  ex_vars.h  @(#)makeoptions	4.2 08/01/80  */
41*558Smark.
42535Smark	w! ex_vars.h
43535Smark	q
44465Smark'X'
45465Smarkifintr:
46535Smarkrm /tmp/foo.c
47