2 * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
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.
10 #pragma ident "%Z%%M% %I% %E% SMI"
13 SM_RCSID("@(#)$Id: strexit.c,v 1.3 2001/01/15 18:39:11 ca Exp $")
14 #include <sm/string.h>
15 #include <sm/sysexits.h>
18 ** SM_STREXIT -- convert EX_* value from <sm/sysexits.h> to a character string
20 ** This function is analogous to strerror(), except that it
21 ** operates on EX_* values from <sm/sysexits.h>.
27 ** pointer to a static message string
37 msg
= sm_sysexitmsg(ex
);
40 (void) sm_snprintf(buf
, sizeof buf
, "Unknown exit status %d",
48 ** SM_SYSEXITMSG -- convert an EX_* value to a character string, or NULL
54 ** If ex is a known exit value, then a pointer to a static
55 ** message string is returned. Otherwise NULL is returned.
64 msg
= sm_sysexmsg(ex
);
72 ** SM_SYSEXMSG -- convert an EX_* value to a character string, or NULL
78 ** If ex is a known exit value, then a pointer to a static
79 ** string is returned. Otherwise NULL is returned.
80 ** The string contains the following fixed width fields:
81 ** [0] ':' if there is an errno value associated with this
82 ** exit value, otherwise ' '.
83 ** [1,3] 3 digit SMTP error code
85 ** [5,9] 3 digit SMTP extended error code
87 ** [11,] message string
97 return " 500 5.0.0 Command line usage error";
99 return " 501 5.6.0 Data format error";
101 return ":550 5.3.0 Cannot open input";
103 return " 550 5.1.1 User unknown";
105 return " 550 5.1.2 Host unknown";
107 return " 554 5.0.0 Service unavailable";
109 return ":554 5.3.0 Internal error";
111 return ":451 4.0.0 Operating system error";
113 return ":554 5.3.5 System file missing";
115 return ":550 5.0.0 Can't create output";
117 return ":451 4.0.0 I/O error";
119 return " 450 4.0.0 Deferred";
121 return " 554 5.5.0 Remote protocol error";
123 return ":550 5.0.0 Insufficient permission";
125 return " 554 5.3.5 Local configuration error";