xref: /illumos-gate/usr/src/cmd/lp/lib/oam/gen-defs (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1#ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
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#
25# Generate ../../include/oam_def.h
26##########
27
28echo "/*This file is automatically generated from msg.source.*/"
29
30csplit -k -s msg.source /E_.*__MSGS/ {99} 2>/dev/null
31
32sed -n -e '/^[ 	]*#/p' xx00
33rm xx00
34
35echo 'extern char		**_oam_msg_base_;'
36for x in xx??
37do
38	BASE=`line <${x}`
39	base=`echo ${BASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
40	echo 'extern char		*'${base}'[];'
41done
42
43for x in xx??
44do
45
46    (
47	BASE=`line`
48	base=`echo ${BASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
49
50	echo "${BASE}"
51
52	sed -e '/^[ 	]*$/d' \
53	| sed -n \
54      -e 's/^[ 	]*\(E_.*\)$/\1:(_oam_msg_base_='${base}',(long)(:-'${BASE}'))/p' \
55      -e '/^[ 	]*#/p'
56    ) <${x}
57
58done \
59| nl -bp"^E_" -v0 -i2 -s: \
60| sed \
61      -e 's/^[ 	]*\([0-9]*\):\(E_.*\):\(.*\):\(.*\)$/#define \2 \3\1\4/' \
62      -e 's/^[ 	]*\([0-9]*\):\(E_.*\)$/#define \2 (\1+2)/' \
63| sed -e 's/^[ 	]*//'
64