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