xref: /onnv-gate/usr/src/lib/fm/libfmevent/common/mkerror.sh (revision 11102:b91faef0c984)
1*11102SGavin.Maltby@Sun.COM#!/bin/ksh -p
2*11102SGavin.Maltby@Sun.COM#
3*11102SGavin.Maltby@Sun.COM# CDDL HEADER START
4*11102SGavin.Maltby@Sun.COM#
5*11102SGavin.Maltby@Sun.COM# The contents of this file are subject to the terms of the
6*11102SGavin.Maltby@Sun.COM# Common Development and Distribution License (the "License").
7*11102SGavin.Maltby@Sun.COM# You may not use this file except in compliance with the License.
8*11102SGavin.Maltby@Sun.COM#
9*11102SGavin.Maltby@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*11102SGavin.Maltby@Sun.COM# or http://www.opensolaris.org/os/licensing.
11*11102SGavin.Maltby@Sun.COM# See the License for the specific language governing permissions
12*11102SGavin.Maltby@Sun.COM# and limitations under the License.
13*11102SGavin.Maltby@Sun.COM#
14*11102SGavin.Maltby@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each
15*11102SGavin.Maltby@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*11102SGavin.Maltby@Sun.COM# If applicable, add the following below this CDDL HEADER, with the
17*11102SGavin.Maltby@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying
18*11102SGavin.Maltby@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner]
19*11102SGavin.Maltby@Sun.COM#
20*11102SGavin.Maltby@Sun.COM# CDDL HEADER END
21*11102SGavin.Maltby@Sun.COM#
22*11102SGavin.Maltby@Sun.COM#
23*11102SGavin.Maltby@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*11102SGavin.Maltby@Sun.COM# Use is subject to license terms.
25*11102SGavin.Maltby@Sun.COM#
26*11102SGavin.Maltby@Sun.COM
27*11102SGavin.Maltby@Sun.COMcat <<EOM
28*11102SGavin.Maltby@Sun.COM/*
29*11102SGavin.Maltby@Sun.COM * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
30*11102SGavin.Maltby@Sun.COM * Use is subject to license terms.
31*11102SGavin.Maltby@Sun.COM */
32*11102SGavin.Maltby@Sun.COM
33*11102SGavin.Maltby@Sun.COM/*
34*11102SGavin.Maltby@Sun.COM * This file was generated during make.
35*11102SGavin.Maltby@Sun.COM */
36*11102SGavin.Maltby@Sun.COM
37*11102SGavin.Maltby@Sun.COM#include <fm/libfmevent.h>
38*11102SGavin.Maltby@Sun.COM
39*11102SGavin.Maltby@Sun.COMstatic const char *_fmev_errstrs[] = {
40*11102SGavin.Maltby@Sun.COMEOM
41*11102SGavin.Maltby@Sun.COM
42*11102SGavin.Maltby@Sun.COMpattern='^    \(FMEVERR_[A-Z0-9_]*\).*\/\* *\(.*\) *\*\/.*'
43*11102SGavin.Maltby@Sun.COMreplace='	"\2" \/\* \1 \*\/,'
44*11102SGavin.Maltby@Sun.COM
45*11102SGavin.Maltby@Sun.COMsed -n "s/$pattern/$replace/p" $1 || exit 1
46*11102SGavin.Maltby@Sun.COM
47*11102SGavin.Maltby@Sun.COMcat <<EOM
48*11102SGavin.Maltby@Sun.COM};
49*11102SGavin.Maltby@Sun.COM
50*11102SGavin.Maltby@Sun.COMstatic const int _fmev_nerrs =
51*11102SGavin.Maltby@Sun.COM    sizeof (_fmev_errstrs) / sizeof (_fmev_errstrs[0]);
52*11102SGavin.Maltby@Sun.COM
53*11102SGavin.Maltby@Sun.COMconst char *
54*11102SGavin.Maltby@Sun.COMfmev_strerror(fmev_err_t err)
55*11102SGavin.Maltby@Sun.COM{
56*11102SGavin.Maltby@Sun.COM	const char *s;
57*11102SGavin.Maltby@Sun.COM
58*11102SGavin.Maltby@Sun.COM	if (err >= FMEVERR_UNKNOWN && (err - FMEVERR_UNKNOWN < _fmev_nerrs))
59*11102SGavin.Maltby@Sun.COM		s = _fmev_errstrs[err - FMEVERR_UNKNOWN];
60*11102SGavin.Maltby@Sun.COM	else
61*11102SGavin.Maltby@Sun.COM		s = _fmev_errstrs[0];
62*11102SGavin.Maltby@Sun.COM
63*11102SGavin.Maltby@Sun.COM	return (s);
64*11102SGavin.Maltby@Sun.COM}
65*11102SGavin.Maltby@Sun.COMEOM
66