Merge commit '00f1a4f432b3d8aad1aa270e91c44c57f03ef407'
[unleashed.git] / usr / src / cmd / sgs / tools / catalog.awk
blob9cceed8adad0902509ff1a9fa92df3e329684975
2 # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 # Use is subject to license terms.
5 # CDDL HEADER START
7 # The contents of this file are subject to the terms of the
8 # Common Development and Distribution License, Version 1.0 only
9 # (the "License"). You may not use this file except in compliance
10 # with the License.
12 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 # or http://www.opensolaris.org/os/licensing.
14 # See the License for the specific language governing permissions
15 # and limitations under the License.
17 # When distributing Covered Code, include this CDDL HEADER in each
18 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 # If applicable, add the following below this CDDL HEADER, with the
20 # fields enclosed by brackets "[]" replaced with your own identifying
21 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # CDDL HEADER END
25 #ident "%Z%%M% %I% %E% SMI"
28 # Extract MACROs from .msg file
29 # The MACROs which are referenced by MSG_INTL() go to CATA_MSG_INTL_LIST
30 # The MACROs which are referenced by MSG_ORIG() go to CATA_MSG_ORIG_LIST
33 BEGIN {
34 # skip == 0
35 # The MACRO will not be recorded
36 skip = 0
38 # which == 0
39 # Collecting MACRO's in between _START_ and _END_
40 # which == 1
41 # Collecting MACRO's in after _END_
42 which = 0
46 # If the MACROs are surrounded by _CHKMSG_SKIP_BEGIN_ and
47 # _CHKMSG_SKIP_END_, these MACRO will not be recorded for checking.
48 # It is assumed that the use of MACRO are checked by developers.
50 /_CHKMSG_SKIP_BEGIN_/ {
51 if ($3 == mach)
52 skip = 1
54 /_CHKMSG_SKIP_END_/ {
55 if ($3 == mach)
56 skip = 0
59 /^@/ {
60 dontprint = 0
62 if ($2 == "_START_") {
63 which = 0
64 dontprint = 1
65 } else if ($2 == "_END_") {
66 which = 1
67 dontprint = 1
68 } else if (match($2, "MSG_ID_") != 0) {
69 dontprint = 1
72 if (skip == 1 || dontprint == 1)
73 next
75 if (which == 0)
76 print $2 >> "CATA_MSG_INTL_LIST"
77 else
78 print $2 >> "CATA_MSG_ORIG_LIST"