/*
* Error handling routines.
*
* The functions in this file are independent of any application
* variables, and may be used in any C program. Either of the names
* CLIENT of SERVER may be defined when compiling this function.
* If neither are defined, we assume SERVER.
*/
#include "vmsgopherd.h"
#include <varargs.h>
#ifdef CLIENT
#ifdef SERVER
/*no way jose, can't define both! (CLIENT and SERVER)*/
#endif
#endif
#ifndef CLIENT
#ifndef SERVER
#define CLIENT 1
#endif
#endif
#ifndef NULL
#define NULL ((void *) 0)
#endif
extern char *pname;
#ifdef CLIENT /* these all output to stderr */
/*
* Fatal error. Print a message and terminate.
* Don't dump core and don't print the system's errno value.
*
* err_quit(str, arg1, arg2, .....)
*
* The string "str" must specify the conversion specification for any args.
*
*/
/*
* Fatal error related to a system call. Print the message and terminate.
* Don't dump core, but do print the systems errno value and its
* associated message.
*
* err_sys(str, arg1, arg2, ...)
*
*/
char emesgst[255] = {0}; /* used by all server routines */
/*
* Identify ourselves, for syslog() messages.
*
* LOG_PID is an option that says prepend each message with our pid.
* LOG_CONS is an option that says write to the console if unable to
* send the message to syslogd.
* LOG_DAEMON is our facility.
*/
/*
* Fatal error related to a system call. Print the message and terminate.
* Don't dump core, but do print the systems errno value and its associated
* message.
*/
/*
* Print the UNIX errno value.
* We just append it the the end of the emesgstr[] array.
*/
void
my_perror()
{
int len;
char *sys_err_str();
len = strlen(emesgstr);
sprintf(emesgstr + len, " %s", sys_err_str());
}
#endif /* SERVER */
extern int vmserrno; /* UNIX error number */
extern int sys_nerr; /* # of error message strings in sys table */
extern char *sys_errlist[]; /* the system error message table */
#ifdef SYS5
int t_errno;
int t_nerr;
char *t_errlist[1];
#endif
/*
* Return a string containing some additional operating system
* dependent information.
* Note that different versions of UNIX assign different meanings
* to the same value of "errno". This means that if an error
* condition is being sent ot another UNIX system, we must interpret
* the errno value on the system that generated the error, and not
* just send the decimal value of errno to the other system.
*/