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