Revert "usbd - Do not start moused by default when a usb mouse is connected"
[dragonfly.git] / contrib / sendmail-8.14 / libsm / strexit.c
blob0f2cdfc6cdfe0b2be8d03078d5005948c27937b8
1 /*
2 * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 */
10 #include <sm/gen.h>
11 SM_RCSID("@(#)$Id: strexit.c,v 1.5 2001/09/11 04:04:49 gshapiro Exp $")
12 #include <sm/string.h>
13 #include <sm/sysexits.h>
16 ** SM_STREXIT -- convert EX_* value from <sm/sysexits.h> to a character string
18 ** This function is analogous to strerror(), except that it
19 ** operates on EX_* values from <sm/sysexits.h>.
21 ** Parameters:
22 ** ex -- EX_* value
24 ** Results:
25 ** pointer to a static message string
28 char *
29 sm_strexit(ex)
30 int ex;
32 char *msg;
33 static char buf[64];
35 msg = sm_sysexitmsg(ex);
36 if (msg == NULL)
38 (void) sm_snprintf(buf, sizeof buf, "Unknown exit status %d",
39 ex);
40 msg = buf;
42 return msg;
46 ** SM_SYSEXITMSG -- convert an EX_* value to a character string, or NULL
48 ** Parameters:
49 ** ex -- EX_* value
51 ** Results:
52 ** If ex is a known exit value, then a pointer to a static
53 ** message string is returned. Otherwise NULL is returned.
56 char *
57 sm_sysexitmsg(ex)
58 int ex;
60 char *msg;
62 msg = sm_sysexmsg(ex);
63 if (msg != NULL)
64 return &msg[11];
65 else
66 return msg;
70 ** SM_SYSEXMSG -- convert an EX_* value to a character string, or NULL
72 ** Parameters:
73 ** ex -- EX_* value
75 ** Results:
76 ** If ex is a known exit value, then a pointer to a static
77 ** string is returned. Otherwise NULL is returned.
78 ** The string contains the following fixed width fields:
79 ** [0] ':' if there is an errno value associated with this
80 ** exit value, otherwise ' '.
81 ** [1,3] 3 digit SMTP error code
82 ** [4] ' '
83 ** [5,9] 3 digit SMTP extended error code
84 ** [10] ' '
85 ** [11,] message string
88 char *
89 sm_sysexmsg(ex)
90 int ex;
92 switch (ex)
94 case EX_USAGE:
95 return " 500 5.0.0 Command line usage error";
96 case EX_DATAERR:
97 return " 501 5.6.0 Data format error";
98 case EX_NOINPUT:
99 return ":550 5.3.0 Cannot open input";
100 case EX_NOUSER:
101 return " 550 5.1.1 User unknown";
102 case EX_NOHOST:
103 return " 550 5.1.2 Host unknown";
104 case EX_UNAVAILABLE:
105 return " 554 5.0.0 Service unavailable";
106 case EX_SOFTWARE:
107 return ":554 5.3.0 Internal error";
108 case EX_OSERR:
109 return ":451 4.0.0 Operating system error";
110 case EX_OSFILE:
111 return ":554 5.3.5 System file missing";
112 case EX_CANTCREAT:
113 return ":550 5.0.0 Can't create output";
114 case EX_IOERR:
115 return ":451 4.0.0 I/O error";
116 case EX_TEMPFAIL:
117 return " 450 4.0.0 Deferred";
118 case EX_PROTOCOL:
119 return " 554 5.5.0 Remote protocol error";
120 case EX_NOPERM:
121 return ":550 5.0.0 Insufficient permission";
122 case EX_CONFIG:
123 return " 554 5.3.5 Local configuration error";
124 default:
125 return NULL;