xref: /illumos-gate/usr/src/cmd/vi/port/makeoptions (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
2*7c478bd9Sstevel@tonic-gate#
3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
4*7c478bd9Sstevel@tonic-gate#
5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
7*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
8*7c478bd9Sstevel@tonic-gate# with the License.
9*7c478bd9Sstevel@tonic-gate#
10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
13*7c478bd9Sstevel@tonic-gate# and limitations under the License.
14*7c478bd9Sstevel@tonic-gate#
15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
20*7c478bd9Sstevel@tonic-gate#
21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate#
24*7c478bd9Sstevel@tonic-gate#	make options --should be run when adding/deleting options
25*7c478bd9Sstevel@tonic-gate#			This script should be run to create a new
26*7c478bd9Sstevel@tonic-gate#			ex_vars.h (based on information in ex_data.c
27*7c478bd9Sstevel@tonic-gate#			Ex_data.c should be writeable.
28*7c478bd9Sstevel@tonic-gate#
29*7c478bd9Sstevel@tonic-gate	cp ex_data.c $$.c
30*7c478bd9Sstevel@tonic-gate#
31*7c478bd9Sstevel@tonic-gate#	write all lines which are not includes to $$.c
32*7c478bd9Sstevel@tonic-gate#
33*7c478bd9Sstevel@tonic-gate	set -x
34*7c478bd9Sstevel@tonic-gate	ex - $$.c << 'STOP'
35*7c478bd9Sstevel@tonic-gateg/^#include/d
36*7c478bd9Sstevel@tonic-gatew
37*7c478bd9Sstevel@tonic-gateq
38*7c478bd9Sstevel@tonic-gateSTOP
39*7c478bd9Sstevel@tonic-gatecc -E $* $$.c > foo.c
40*7c478bd9Sstevel@tonic-gate#
41*7c478bd9Sstevel@tonic-gate#	use EX to clean up preprocessor output
42*7c478bd9Sstevel@tonic-gate#
43*7c478bd9Sstevel@tonic-gate	ex - foo.c << 'STOP'
44*7c478bd9Sstevel@tonic-gate!echo STEP1
45*7c478bd9Sstevel@tonic-gate$-1,$d
46*7c478bd9Sstevel@tonic-gate1,/option options/d
47*7c478bd9Sstevel@tonic-gate!echo STEP2
48*7c478bd9Sstevel@tonic-gateg/^# /d
49*7c478bd9Sstevel@tonic-gate!echo STEP3
50*7c478bd9Sstevel@tonic-gateg/^[	]*$/d
51*7c478bd9Sstevel@tonic-gate!echo STEP4
52*7c478bd9Sstevel@tonic-gate%s/	\"//
53*7c478bd9Sstevel@tonic-gate!echo STEP5
54*7c478bd9Sstevel@tonic-gate%s/\".*//
55*7c478bd9Sstevel@tonic-gate!echo STEP6
56*7c478bd9Sstevel@tonic-gate1m$
57*7c478bd9Sstevel@tonic-gate!echo STEP7
58*7c478bd9Sstevel@tonic-gatew! tmpfile1
59*7c478bd9Sstevel@tonic-gate!pr -t -n tmpfile1 > tmpfile2
60*7c478bd9Sstevel@tonic-gate!echo STEP8
61*7c478bd9Sstevel@tonic-gateq
62*7c478bd9Sstevel@tonic-gateSTOP
63*7c478bd9Sstevel@tonic-gate#
64*7c478bd9Sstevel@tonic-gate	ex -s tmpfile2 << 'STOP'
65*7c478bd9Sstevel@tonic-gate$t0
66*7c478bd9Sstevel@tonic-gate!echo STEP9
67*7c478bd9Sstevel@tonic-gate1s/....../    0	/
68*7c478bd9Sstevel@tonic-gate!echo STEP10
69*7c478bd9Sstevel@tonic-gatew len4
70*7c478bd9Sstevel@tonic-gate%s/\(......\)\(.*\)/vi_\U\2\L		\1/
71*7c478bd9Sstevel@tonic-gate!echo STEP11
72*7c478bd9Sstevel@tonic-gate%s/	$//
73*7c478bd9Sstevel@tonic-gate!echo STEP12
74*7c478bd9Sstevel@tonic-gate%s/[ ][ ]*/	/
75*7c478bd9Sstevel@tonic-gate!echo STEP13
76*7c478bd9Sstevel@tonic-gate$s/.*	/vi_NOPTS		/
77*7c478bd9Sstevel@tonic-gate!echo STEP14
78*7c478bd9Sstevel@tonic-gate%s/\([A-Z][A-Z][A-Z][A-Z][A-Z][A-Z]*\)\(	\)/\1/
79*7c478bd9Sstevel@tonic-gate!echo STEP15
80*7c478bd9Sstevel@tonic-gate%s/.*/#define	&/
81*7c478bd9Sstevel@tonic-gate!echo STEP16
82*7c478bd9Sstevel@tonic-gate$i
83*7c478bd9Sstevel@tonic-gate
84*7c478bd9Sstevel@tonic-gate.
85*7c478bd9Sstevel@tonic-gate0a
86*7c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
87*7c478bd9Sstevel@tonic-gate.
88*7c478bd9Sstevel@tonic-gatew! ex_vars.h
89*7c478bd9Sstevel@tonic-gateq
90*7c478bd9Sstevel@tonic-gateSTOP
91*7c478bd9Sstevel@tonic-gateecho finished....
92