1 /*
2  * Copyright (c) 1988 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  *
12  *  Sendmail
13  *  Copyright (c) 1983  Eric P. Allman
14  *  Berkeley, California
15  */
16 
17 #ifndef lint
18 static char sccsid[] = "@(#)sysexits.c	5.4 (Berkeley) 04/01/88";
19 #endif /* not lint */
20 
21 #include <sysexits.h>
22 
23 /*
24  *  SYSEXITS.C -- error messages corresponding to sysexits.h
25  */
26 char *SysExMsg[] = {
27 	/* 64 USAGE */		"500 Bad usage",
28 	/* 65 DATAERR */	"501 Data format error",
29 	/* 66 NOINPUT */	"550 Cannot open input",
30 	/* 67 NOUSER */		"550 User unknown",
31 	/* 68 NOHOST */		"550 Host unknown",
32 	/* 69 UNAVAILABLE */	"554 Service unavailable",
33 	/* 70 SOFTWARE */	"554 Internal error",
34 	/* 71 OSERR */		"451 Operating system error",
35 	/* 72 OSFILE */		"554 System file missing",
36 	/* 73 CANTCREAT */	"550 Can't create output",
37 	/* 74 IOERR */		"451 I/O error",
38 	/* 75 TEMPFAIL */	"250 Deferred",
39 	/* 76 PROTOCOL */	"554 Remote protocol error",
40 	/* 77 NOPERM */		"550 Insufficient permission",
41 	/* 78 CONFIG */		"554 Local configuration error",
42 };
43 
44 int N_SysEx = sizeof(SysExMsg) / sizeof(SysExMsg[0]);
45 
46 /*
47  *  STATSTRING -- return string corresponding to an error status
48  *
49  *	Parameters:
50  *		stat -- the status to decode.
51  *
52  *	Returns:
53  *		The string corresponding to that status
54  *
55  *	Side Effects:
56  *		none.
57  */
58 char *
59 statstring(stat)
60 	int stat;
61 {
62 	static char ebuf[50];
63 
64 	stat -= EX__BASE;
65 	if (stat < 0 || stat >= N_SysEx) {
66 		(void)sprintf(ebuf, "554 Unknown status %d", stat + EX__BASE);
67 		return(ebuf);
68 	}
69 	return(SysExMsg[stat]);
70 }
71