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