6811333 Remove prom_printf() message in emlxs driver
[opensolaris.git] / usr / src / lib / libbsm / mkhdr.sh
blobe82a5d67d616b8bffbd3eed79207e51d999ffdfc
1 #!/bin/sh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
26 # ident "%Z%%M% %I% %E% SMI"
29 # Automagically generate the audit_uevents.h header file.
31 DATABASE=audit_event.txt
32 HEADER_FILE=audit_uevents.h
34 cat <<EOF > $HEADER_FILE
36 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
37 * Use is subject to license terms.
40 #ifndef _BSM_AUDIT_UEVENTS_H
41 #define _BSM_AUDIT_UEVENTS_H
43 EOF
45 grep '^# ident' $DATABASE | sed -e 's/^#/#pragma/' \
46 -e "s/$DATABASE/$HEADER_FILE/" >> $HEADER_FILE
48 cat <<EOF >> $HEADER_FILE
51 * User level audit event numbers.
53 * 0 Reserved as an invalid event number.
54 * 1 - 2047 Reserved for the Solaris Kernel events.
55 * 2048 - 32767 Reserved for the Solaris TCB programs.
56 * 32768 - 65535 Available for third party TCB applications.
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
64 EOF
66 nawk -F: '{if ((NF == 4) && substr($1,0,1) != "#")
67 if ($1 >= 2048) {
68 tlen = length($2);
70 printf("#define\t%s\t", $2)
71 if (tlen < 8)
72 printf("\t");
73 if (tlen < 16)
74 printf("\t");
75 if (tlen < 24)
76 printf("\t");
77 printf("%s\n", $1);
79 }' \
80 < $DATABASE >> $HEADER_FILE
82 cat <<EOF >> $HEADER_FILE
84 #ifdef __cplusplus
86 #endif
88 #endif /* _BSM_AUDIT_UEVENTS_H */
89 EOF
91 exit 0