1297Seric # include <sysexits.h>
25196Seric # include "useful.h"
3297Seric 
4*21059Seric SCCSID(@(#)sysexits.c	4.3		05/24/85);
5297Seric 
6575Seric /*
7575Seric **  SYSEXITS.C -- error messages corresponding to sysexits.h
8575Seric */
9409Seric 
10297Seric char	*SysExMsg[] =
11297Seric {
128005Seric 	/* 64 USAGE */		"500 Bad usage",
138005Seric 	/* 65 DATAERR */	"501 Data format error",
148005Seric 	/* 66 NOINPUT */	"550 Cannot open input",
158005Seric 	/* 67 NOUSER */		"550 User unknown",
168005Seric 	/* 68 NOHOST */		"550 Host unknown",
178005Seric 	/* 69 UNAVAILABLE */	"554 Service unavailable",
188005Seric 	/* 70 SOFTWARE */	"554 Internal error",
198005Seric 	/* 71 OSERR */		"451 Operating system error",
208005Seric 	/* 72 OSFILE */		"554 System file missing",
218005Seric 	/* 73 CANTCREAT */	"550 Can't create output",
228005Seric 	/* 74 IOERR */		"451 I/O error",
2310124Seric 	/* 75 TEMPFAIL */	"250 Deferred",
248005Seric 	/* 76 PROTOCOL */	"554 Remote protocol error",
2514305Seric 	/* 77 NOPERM */		"550 Insufficient permission",
26297Seric };
27297Seric 
28297Seric int	N_SysEx = sizeof SysExMsg / sizeof SysExMsg[0];
29*21059Seric /*
30*21059Seric **  STATSTRING -- return string corresponding to an error status
31*21059Seric **
32*21059Seric **	Parameters:
33*21059Seric **		stat -- the status to decode.
34*21059Seric **
35*21059Seric **	Returns:
36*21059Seric **		The string corresponding to that status
37*21059Seric **
38*21059Seric **	Side Effects:
39*21059Seric **		none.
40*21059Seric */
41*21059Seric 
42*21059Seric char *
43*21059Seric statstring(stat)
44*21059Seric 	int stat;
45*21059Seric {
46*21059Seric 	static char ebuf[100];
47*21059Seric 
48*21059Seric 	stat -= EX__BASE;
49*21059Seric 	if (stat < 0 || stat >= N_SysEx)
50*21059Seric 	{
51*21059Seric 		(void) sprintf(ebuf, "554 Unknown status %d", stat + EX__BASE);
52*21059Seric 		return (ebuf);
53*21059Seric 	}
54*21059Seric 
55*21059Seric 	return (SysExMsg[stat]);
56*21059Seric }
57