Print this page
XXX Remove nawk(1)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sgs/tools/chkmsg.sh
+++ new/usr/src/cmd/sgs/tools/chkmsg.sh
1 1 #!/bin/sh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 -# ident "%Z%%M% %I% %E% SMI"
28 27
29 28 TOOLDIR="${SRC}/cmd/sgs/tools/"
30 29
31 30 #
32 31 # remove the temporary files
33 32 #
34 33 rm -f CATA_MSG_INTL_LIST CATA_MSG_ORIG_LIST
35 34 rm -f MSG_INTL_LIST MSG_ORIG_LIST
36 35
37 36 while getopts "m:" Arg
38 37 do
39 38 case $Arg in
40 - m) nawk -f ${TOOLDIR}/catalog.awk $OPTARG ;;
39 + m) /usr/xpg4/bin/awk -f ${TOOLDIR}/catalog.awk $OPTARG ;;
41 40 \?) echo "usage: chkmsg -m msgfile source-files" ; exit 1 ;;
42 41 esac
43 42 done
44 43 shift `expr $OPTIND - 1`
45 44
46 45 if [ $# -eq 0 ]; then
47 46 echo "usage: chkmsg -m msgfile source-files"
48 47 exit 1
49 48 fi
50 49
51 50 #
52 51 # Sort the MSG_INTL() and MSG_ORIG() entries. Note, messages can come in _32
53 52 # and _64 flavors - if so strip the suffix and uniquify the output.
54 53 #
55 54 if [ -s CATA_MSG_INTL_LIST ] ; then
56 55 sed -e "s/_32$//" -e "s/_64$//" CATA_MSG_INTL_LIST | sort | uniq > _TMP
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
57 56 mv _TMP CATA_MSG_INTL_LIST
58 57 fi
59 58 if [ -s CATA_MSG_ORIG_LIST ] ; then
60 59 sed -e "s/_32$//" -e "s/_64$//" CATA_MSG_ORIG_LIST | sort | uniq > _TMP
61 60 mv _TMP CATA_MSG_ORIG_LIST
62 61 fi
63 62
64 63 #
65 64 # Generate the lists for the source files and sort them
66 65 #
67 -nawk -f ${TOOLDIR}/getmessage.awk $*
66 +/usr/xpg4/bin/awk -f ${TOOLDIR}/getmessage.awk $*
68 67
69 68 if [ -s MSG_INTL_LIST ] ; then
70 69 sed -e "s/_32$//" -e "s/_64$//" MSG_INTL_LIST | sort | uniq > _TMP
71 70 mv _TMP MSG_INTL_LIST
72 71 fi
73 72 if [ -s MSG_ORIG_LIST ] ; then
74 73 sed -e "s/_32$//" -e "s/_64$//" MSG_ORIG_LIST | sort | uniq > _TMP
75 74 mv _TMP MSG_ORIG_LIST
76 75 fi
77 76
78 77 #
79 78 # Start checking
80 79 #
81 80 Error=0
82 81
83 82 #
84 83 # Check MESG_INTL message
85 84 #
86 85 comm -23 CATA_MSG_INTL_LIST MSG_INTL_LIST > _TMP 2> /dev/null
87 86 if [ -s _TMP ]; then
88 87 echo
89 88 echo "messages exist between _START_ and _END_ but do not use MSG_INTL()"
90 89 cat _TMP | sed "s/^/ /"
91 90 Error=1
92 91 fi
93 92 rm -f _TMP
94 93
95 94 comm -13 CATA_MSG_INTL_LIST MSG_INTL_LIST > _TMP 2> /dev/null
96 95 if [ -s _TMP ]; then
97 96 echo
98 97 echo "use of MSG_INTL() but messages do not exist between _START_ and _END_"
99 98 cat _TMP | sed "s/^/ /"
100 99 Error=1
101 100 fi
102 101 rm -f _TMP
103 102
104 103 #
105 104 # Check MESG_ORIG message
106 105 #
107 106 comm -23 CATA_MSG_ORIG_LIST MSG_ORIG_LIST > _TMP 2> /dev/null
108 107 if [ -s _TMP ]; then
109 108 echo
110 109 echo "messages exist after _END_ but do not use MSG_ORIG()"
111 110 cat _TMP | sed "s/^/ /"
112 111 Error=1
113 112 fi
114 113 rm -f _TMP
115 114
116 115 comm -13 CATA_MSG_ORIG_LIST MSG_ORIG_LIST > _TMP 2> /dev/null
117 116 if [ -s _TMP ]; then
118 117 echo
119 118 echo "use of MSG_ORIG() but messages do not exist after _END_"
120 119 cat _TMP | sed "s/^/ /"
121 120 Error=1
122 121 fi
123 122 rm -f _TMP
124 123
125 124 #
126 125 # remove the temporary files
127 126 #
128 127 rm -f CATA_MSG_INTL_LIST CATA_MSG_ORIG_LIST
129 128 rm -f MSG_INTL_LIST MSG_ORIG_LIST
130 129
131 130 exit $Error
↓ open down ↓ |
54 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX