BSD 4 release
[unix-history] / usr / src / cmd / ex / makeoptions
old mode 100755 (executable)
new mode 100644 (file)
index 84d2639..87420c1
@@ -1,40 +1,46 @@
 #
 # remake options -- this isn't necessary unless you add/delete options
 #
 #
 # remake options -- this isn't necessary unless you add/delete options
 #
-       onintr ifintr
-       cp ex_data.c /tmp/$$.c
-       ex - /tmp/$$.c <<'%'
-               g/^#include/d
-               w
-               q
+onintr ifintr
+cp ex_data.c /tmp/$$.c
+ex - /tmp/$$.c <<'%'
+       g/^#include/d
+       w
+       q
 '%'
 '%'
-       cc -E $* /tmp/$$.c >/tmp/foo.c
-       ex - /tmp/foo.c <<'X'
-               g/^# /d
-               set sh=/bin/csh
-               g/^[    ]*$/d
-               1,/options/d
-               /}/-1,$d
-               1,$s/   "//
-               1,$s/".*//
-               1m$
-               w! ex_vars.h
-               !rm -f %; num ex_vars.h >%
-               e
-               $t0
-               1s/......../     0  /
-               1,$s/\(......\)\(.*\)/#define   \U\2\L  \1/
-               1,$s/    */     /g
-               g/  */s//       /g
-               w
-               !rm -f ex_vars.h; expand -8,24 % >ex_vars.h
-               e! ex_vars.h
-               $i
+cc -E $* /tmp/$$.c >/tmp/foo.c
+ex - /tmp/foo.c <<'X'
+       " delete all preprocessor output (# line, etc)
+       g/^# /d
+       set sh=/bin/csh
+       " delete junk (all but data lines)
+       g/^[    ]*$/d
+       1,/option options/d
+       /}/-1,$d
+       " get rid of all of line but option name
+       1,$s/   "//
+       1,$s/".*//
+       1m$     " kludge since options start at 0 but num at 1
+       %!num
+       $t0     " unkludge
+       1s/......../     0  /   " unkludge
+       " make #define lines
+       1,$s/\(......\)\(.*\)/#define   \U\2\L  \1/
+       " get rid of extra blanks, turning into (single) tabs.
+       1,$s/    */     /g
+       g/  */s//       /g
+       " filter through expand to make it line up nice
+       %!expand -8\,24
+       " blank line and number of options.
+       $i
 
 .
 
 .
-               $s/e[   ].*[    ]/e     NOPTS   /
-               w
-               q
+       $s/e[   ].*[    ]/e     NOPTS   /
+       0a
+       /*  sccs id   @(#)  ex_vars.h  @(#)makeoptions  6.1 10/18/80  */
+.
+       w! ex_vars.h
+       q
 'X'
 ifintr:
 'X'
 ifintr:
-       rm /tmp/foo.c
+rm /tmp/foo.c