6 # The contents of this file are subject to the terms of the
7 # Common Development and Distribution License (the "License").
8 # You may not use this file except in compliance with the License.
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.
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]
24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 #ident "%Z%%M% %I% %E% SMI"
30 # Construct translation tables for defines in libipmi.h to translate to readable
35 echo >&2 "USAGE: $0 <path to libimpi.h>"
42 echo >&2 "USAGE: $0 <path to libimpi.h>"
43 echo >&2 "Make sure libipmi.h exists and is readable"
49 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
50 * Use is subject to license terms.
53 #pragma ident \"%Z%%M% %I% %E% SMI\"
56 #include <ipmi_impl.h>"
62 ipmi_name_trans_t ipmi_errno_table[] = {"
64 pattern
=" \(EIPMI_[0-9A-Z_]*\)[^ \/]*\/\* \(.*\) \*\/$"
65 replace
=" { \1, \"\2\" },"
67 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
75 echo "\nipmi_name_trans_t ipmi_entity_table[] = {"
77 pattern
="#define IPMI_ET_\([A-Z0-9_]*\).*\$"
78 replace
=" { IPMI_ET_\1, \"\1\" },"
80 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
88 echo "\nipmi_name_trans_t ipmi_sensor_type_table[] = {"
90 pattern
="#define IPMI_ST_\([A-Z0-9_]*\).*\$"
91 replace
=" { IPMI_ST_\1, \"\1\" },"
93 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
101 echo "\nipmi_name_trans_t ipmi_reading_type_table[] = {"
103 pattern
="#define IPMI_RT_\([A-Z0-9_]*\).*\$"
104 replace
=" { IPMI_RT_\1, \"\1\" },"
106 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
114 echo "\nipmi_name_trans_t ipmi_units_type_table[] = {"
116 pattern
="#define IPMI_UNITS_\([A-Z0-9_]*\).*\$"
117 replace
=" { IPMI_UNITS_\1, \"\1\" },"
119 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1