#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
##########
#
# Generate ../../include/oam_def.h
##########
echo "/*This file is automatically generated from msg.source.*/"
csplit -k -s msg.source /E_.*__MSGS/ {99} 2>/dev/null
sed -n -e '/^[ ]*#/p' xx00
rm xx00
echo 'extern char **_oam_msg_base_;'
for x in xx??
do
BASE=`line <${x}`
base=`echo ${BASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
echo 'extern char *'${base}'[];'
done
for x in xx??
do
(
BASE=`line`
base=`echo ${BASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
echo "${BASE}"
sed -e '/^[ ]*$/d' \
| sed -n \
-e 's/^[ ]*\(E_.*\)$/\1:(_oam_msg_base_='${base}',(long)(:-'${BASE}'))/p' \
-e '/^[ ]*#/p'
) <${x}
done \
| nl -bp"^E_" -v0 -i2 -s: \
| sed \
-e 's/^[ ]*\([0-9]*\):\(E_.*\):\(.*\):\(.*\)$/#define \2 \3\1\4/' \
-e 's/^[ ]*\([0-9]*\):\(E_.*\)$/#define \2 (\1+2)/' \
| sed -e 's/^[ ]*//'