8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libtnfctl / prb_status.c
blob6958ed923237109aa5eb79375050f070c69237ef
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * 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 (c) 1994, by Sun Microsytems, Inc.
26 #pragma ident "%Z%%M% %I% %E% SMI"
29 * Interfaces to print error codes and to map an errno to an error code.
32 #include <string.h>
33 #include <libintl.h>
35 #include "tnfctl_int.h"
36 #include "dbg.h"
39 #if !defined(TEXT_DOMAIN)
40 #define TEXT_DOMAIN "SYS_TEST"
41 #endif
44 * prb_status_str() - this routine returns a pointer to a static string
45 * describing the error argument.
47 const char *
48 prb_status_str(prb_status_t prbstat)
50 /* if this is in the errno range, use the errno string */
51 if (prbstat >= PRB_STATUS_MINERRNO &&
52 prbstat <= PRB_STATUS_MAXERRNO) {
53 return (strerror(prbstat));
54 } else {
55 switch (prbstat) {
56 case PRB_STATUS_OK:
57 return (dgettext(TEXT_DOMAIN, "success"));
58 case PRB_STATUS_ALLOCFAIL:
59 return (dgettext(TEXT_DOMAIN,
60 "memory allocation failed"));
61 case PRB_STATUS_BADARG:
62 return (dgettext(TEXT_DOMAIN, "bad input argument"));
63 case PRB_STATUS_BADSYNC:
64 return (dgettext(TEXT_DOMAIN,
65 "couldn't sync with rtld"));
66 case PRB_STATUS_BADLMAPSTATE:
67 return (dgettext(TEXT_DOMAIN, "inconsistent link map"));
68 default:
69 return (dgettext(TEXT_DOMAIN,
70 "Unknown libtnfctl.so prb layer error code"));
76 * prb_status_map() - this routine converts an errno value into a
77 * prb_status_t.
79 prb_status_t
80 prb_status_map(int val)
82 return (val);