122715Sdist /*
2*33731Sbostic  * Copyright (c) 1988 Regents of the University of California.
3*33731Sbostic  * All rights reserved.
4*33731Sbostic  *
5*33731Sbostic  * Redistribution and use in source and binary forms are permitted
6*33731Sbostic  * provided that this notice is preserved and that due credit is given
7*33731Sbostic  * to the University of California at Berkeley. The name of the University
8*33731Sbostic  * may not be used to endorse or promote products derived from this
9*33731Sbostic  * software without specific prior written permission. This software
10*33731Sbostic  * is provided ``as is'' without express or implied warranty.
11*33731Sbostic  *
12*33731Sbostic  *  Sendmail
13*33731Sbostic  *  Copyright (c) 1983  Eric P. Allman
14*33731Sbostic  *  Berkeley, California
15*33731Sbostic  */
1622715Sdist 
1722715Sdist #ifndef lint
18*33731Sbostic static char sccsid[] = "@(#)sysexits.c	5.3 (Berkeley) 03/13/88";
19*33731Sbostic #endif /* not lint */
2022715Sdist 
21297Seric # include <sysexits.h>
225196Seric # include "useful.h"
23297Seric 
24575Seric /*
25575Seric **  SYSEXITS.C -- error messages corresponding to sysexits.h
26575Seric */
27409Seric 
28297Seric char	*SysExMsg[] =
29297Seric {
308005Seric 	/* 64 USAGE */		"500 Bad usage",
318005Seric 	/* 65 DATAERR */	"501 Data format error",
328005Seric 	/* 66 NOINPUT */	"550 Cannot open input",
338005Seric 	/* 67 NOUSER */		"550 User unknown",
348005Seric 	/* 68 NOHOST */		"550 Host unknown",
358005Seric 	/* 69 UNAVAILABLE */	"554 Service unavailable",
368005Seric 	/* 70 SOFTWARE */	"554 Internal error",
378005Seric 	/* 71 OSERR */		"451 Operating system error",
388005Seric 	/* 72 OSFILE */		"554 System file missing",
398005Seric 	/* 73 CANTCREAT */	"550 Can't create output",
408005Seric 	/* 74 IOERR */		"451 I/O error",
4110124Seric 	/* 75 TEMPFAIL */	"250 Deferred",
428005Seric 	/* 76 PROTOCOL */	"554 Remote protocol error",
4314305Seric 	/* 77 NOPERM */		"550 Insufficient permission",
44297Seric };
45297Seric 
46297Seric int	N_SysEx = sizeof SysExMsg / sizeof SysExMsg[0];
4721059Seric /*
4821059Seric **  STATSTRING -- return string corresponding to an error status
4921059Seric **
5021059Seric **	Parameters:
5121059Seric **		stat -- the status to decode.
5221059Seric **
5321059Seric **	Returns:
5421059Seric **		The string corresponding to that status
5521059Seric **
5621059Seric **	Side Effects:
5721059Seric **		none.
5821059Seric */
5921059Seric 
6021059Seric char *
6121059Seric statstring(stat)
6221059Seric 	int stat;
6321059Seric {
6421059Seric 	static char ebuf[100];
6521059Seric 
6621059Seric 	stat -= EX__BASE;
6721059Seric 	if (stat < 0 || stat >= N_SysEx)
6821059Seric 	{
6921059Seric 		(void) sprintf(ebuf, "554 Unknown status %d", stat + EX__BASE);
7021059Seric 		return (ebuf);
7121059Seric 	}
7221059Seric 
7321059Seric 	return (SysExMsg[stat]);
7421059Seric }
75