62 lines
1.3 KiB
Tcsh
62 lines
1.3 KiB
Tcsh
#!/bin/csh -f
|
|
#
|
|
# Copyright (c) 1991, 1993
|
|
# The Regents of the University of California. All rights reserved.
|
|
#
|
|
# This module is believed to contain source code proprietary to AT&T.
|
|
# Use and redistribution is subject to the Berkeley Software License
|
|
# Agreement and your Software Agreement with AT&T (Western Electric).
|
|
#
|
|
# @(#)makeoptions 8.1 (Berkeley) 6/9/93
|
|
#
|
|
|
|
# remake options -- this isn't necessary unless you add/delete options
|
|
#
|
|
set TMP1=/tmp/_vi_vars1.c
|
|
set TMP2=/tmp/_vi_vars2
|
|
onintr ifintr
|
|
|
|
cat < $argv[1] > $TMP1
|
|
ex - $TMP1 <<'%'
|
|
g/^#include/d
|
|
w
|
|
q
|
|
'%'
|
|
shift
|
|
$* $TMP1 > $TMP2
|
|
ex - $TMP2 <<'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/".*//
|
|
" begin kludge since options start at 0 but cat -n starts at 1
|
|
" move first to end and later move it back and renumber
|
|
1m$
|
|
%!cat -n
|
|
$t0
|
|
1s/[0-9][0-9]*/0/
|
|
" end kludge
|
|
" make #define lines
|
|
1,$s/[ ]*\([0-9][0-9]*\)[ ]*\(.*\)/#define \U\2\L \1/
|
|
" filter through expand to make it line up nice
|
|
%!expand -8\,24
|
|
" blank line and number of options.
|
|
$i
|
|
|
|
.
|
|
$s/e[ ].*[ ]/e NOPTS /
|
|
0a
|
|
/* sccs id @(#) ex_vars.h @(#)makeoptions 8.1 6/9/93 */
|
|
.
|
|
w! ex_vars.h
|
|
q
|
|
'X'
|
|
ifintr:
|
|
rm $TMP1 $TMP2
|