Annotation of 43BSDReno/usr.bin/ex/makeoptions, revision 1.1.1.1

1.1       root        1: #
                      2: # Copyright (c) 1980 Regents of the University of California.
                      3: # All rights reserved.  The Berkeley software License Agreement
                      4: # specifies the terms and conditions for redistribution.
                      5: #
                      6: #      @(#)makeoptions 6.6 (Berkeley) 6/28/90
                      7: #
                      8: 
                      9: #
                     10: # remake options -- this isn't necessary unless you add/delete options
                     11: #
                     12: set TMP1=/tmp/_vi_vars1
                     13: set TMP2=/tmp/_vi_vars2
                     14: onintr ifintr
                     15: 
                     16: cat < $argv[1] > $TMP1
                     17: ex - $TMP1 <<'%'
                     18:        g/^#include/d
                     19:        w
                     20:        q
                     21: '%'
                     22: shift
                     23: cpp $* $TMP1 > $TMP2
                     24: ex - $TMP2 <<'X'
                     25:        " delete all preprocessor output (# line, etc)
                     26:        g/^# /d
                     27:        set sh=/bin/csh
                     28:        " delete junk (all but data lines)
                     29:        g/^[    ]*$/d
                     30:        1,/option options/d
                     31:        /}/-1,$d
                     32:        " get rid of all of line but option name
                     33:        1,$s/[  ]*"//
                     34:        1,$s/".*//
                     35:        " begin kludge since options start at 0 but cat -n starts at 1
                     36:        "              move first to end and later move it back and renumber
                     37:        1m$
                     38:        %!cat -n
                     39:        $t0
                     40:        1s/[0-9][0-9]*/0/
                     41:        " end kludge
                     42:        " make #define lines
                     43:        1,$s/[  ]*\([0-9][0-9]*\)[      ]*\(.*\)/#define        \U\2\L  \1/
                     44:        " filter through expand to make it line up nice
                     45:        %!expand -8\,24
                     46:        " blank line and number of options.
                     47:        $i
                     48: 
                     49: .
                     50:        $s/e[   ].*[    ]/e     NOPTS   /
                     51:        0a
                     52:        /*  sccs id   @(#)  ex_vars.h  @(#)makeoptions  6.6 6/28/90  */
                     53: .
                     54:        w! ex_vars.h
                     55:        q
                     56: 'X'
                     57: ifintr:
                     58: rm $TMP1 $TMP2

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.