DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T e

⟦433fb4f09⟧ TextFile

    Length: 4403 (0x1133)
    Types: TextFile
    Names: »error_str.c«

Derivation

└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦038380b96⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦038380b96⟧ 
            └─ ⟦this⟧ »error_str.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
            └─ ⟦this⟧ »../../dtia/release_apollo_2.1/error_str.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦25fab149a⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦25fab149a⟧ 
            └─ ⟦this⟧ »../../dtia/release_sun_2.1/error_str.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦be254d495⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦be254d495⟧ 
            └─ ⟦this⟧ »../../dtia/release_aix_2.1/error_str.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦c67979795⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦c67979795⟧ 
            └─ ⟦this⟧ »../../dtia/release_hp_2.1/error_str.c« 

TextFile

#ifndef	lint
#ifndef	DEBUG
static char SCCS_id[] = "@(#)error_str.c 2.1 90/08/10 17:38:33  Copyright(c) 1990 by Rational.";
#else
static char SCCS_id[] = "@(#)error_str.c DEBUG 2.1 90/08/10 17:38:33  Copyright(c) 1990 by Rational.";
#endif
#endif

#define	ERROR_STR
#include	"talk.h"
#undef	ERROR_STR
extern		int	sys_nerr;
extern		char	*sys_errlist[];
extern		int	errno;

#define	SEPARATOR	(-1)
static	int	errors_list[] = {
	R_CREATE,
	E_POLICY_ERROR,
	E_STATUS_ERROR,
	E_USE_ERROR,
	E_DEVICE_ERROR,
	E_NAME_ERROR,
	E_UNSUPPORTED,
	SEPARATOR,

	R_PUT,
	E_POLICY_ERROR,
	E_RESOURCE_LIMIT,
	E_STATUS_ERROR,
	E_USE_ERROR,
	E_DEVICE_ERROR,
	E_NAME_ERROR,
	E_UNSUPPORTED,
	SEPARATOR,

	R_GET,
	E_POLICY_ERROR,
	E_RESOURCE_LIMIT,
	E_STATUS_ERROR,
	E_DEVICE_ERROR,
	E_USE_ERROR,
	E_NAME_ERROR,
	E_UNSUPPORTED,
	SEPARATOR,

	R_LAST_UPDATE,
	E_POLICY_ERROR,
	E_STATUS_ERROR,
	E_DEVICE_ERROR,
	E_NAME_ERROR,
	E_USE_ERROR,
	SEPARATOR,

	R_FILE_EXISTS,
	E_POLICY_ERROR,
	E_STATUS_ERROR,
	E_DEVICE_ERROR,
	E_NAME_ERROR,
	E_USE_ERROR,
	SEPARATOR,

	R_COPY,
	E_ACCESS_ERROR,
	E_POLICY_ERROR,
	E_RESOURCE_LIMIT,
	E_STATUS_ERROR,
	E_DEVICE_ERROR,
	E_USE_ERROR,
	E_NAME_ERROR,
	E_UNSUPPORTED,
	SEPARATOR,

	R_DELETE,
	E_ACCESS_ERROR,
	E_POLICY_ERROR,
	E_STATUS_ERROR,
	E_DEVICE_ERROR,
	E_NAME_ERROR,
	E_USE_ERROR,
	SEPARATOR,

	R_MOVE,
	E_POLICY_ERROR,
	E_DEVICE_ERROR,
	E_NAME_ERROR,
	E_USE_ERROR,
	SEPARATOR,

	R_LS,
	SEPARATOR,

	R_INPUT_TO_SHELL,
	E_ACCESS_ERROR,
	E_RESOURCE_LIMIT,
	E_STATUS_ERROR,
	E_DEVICE_ERROR,
	E_USE_ERROR,
	E_COMMAND_ERROR,
	E_COMMAND_TERMINATED,
	E_COMMAND_TIMED_OUT,
	E_UNSUPPORTED,
	SEPARATOR,

	R_SIGNAL_TO_SHELL,
	E_COMMAND_TERMINATED,
	SEPARATOR
};

static	int	acceptable(rat_req,err)	int	rat_req,err; 
{
	int	index;
	int	current_request;
	if (err == E_OK)	return TRUE;
	index = 0;
	while (index < (sizeof(errors_list)/sizeof(int))) {
		current_request = errors_list[index];
		if (current_request == rat_req) {
			while (errors_list[index] != SEPARATOR) {
				if (errors_list[index] == err)	return	TRUE;
				index++;
			}
			return	FALSE;
		} else {
			while (errors_list[index] != SEPARATOR)	index++;
			index++;
		}
	}
	return	FALSE;
}

static	struct	_s {
	int	unix_error,rational_error;
}	u_to_r[] = {
	{	EACCES,		E_POLICY_ERROR	},
	{	EAGAIN,		E_RESOURCE_LIMIT},
	{	EBADF,		E_STATUS_ERROR	},
	{	EBUSY,		E_DEVICE_ERROR	},
	{	EEXIST,		E_USE_ERROR	},
	{	EFAULT,		E_USE_ERROR	},
	{	EFBIG,		E_USE_ERROR	},
	{	EINTR,		E_DEVICE_ERROR	},
	{	EINVAL,		E_DEVICE_ERROR	},
	{	EIO,		E_DEVICE_ERROR	},
	{	EISDIR,		E_USE_ERROR	},
	{	ELOOP,		E_NAME_ERROR	},
	{	EMFILE,		E_DEVICE_ERROR	},
	{	ENAMETOOLONG,	E_NAME_ERROR	},
	{	ENFILE,		E_DEVICE_ERROR	},
	{	ENOENT,		E_NAME_ERROR	},
	{	ENOMEM,		E_RESOURCE_LIMIT},
	{	ENOSPC,		E_DEVICE_ERROR	},
	{	ENOTDIR,	E_USE_ERROR	},
	{	ENOTEMPTY,	E_USE_ERROR	},
	{	ENXIO,		E_DEVICE_ERROR	},
	{	EOPNOTSUPP,	E_UNSUPPORTED	},
	{	EPERM,		E_ACCESS_ERROR	},
	{	EPIPE,		E_DEVICE_ERROR	},
	{	ERANGE,		E_DEVICE_ERROR	},
	{	EROFS,		E_USE_ERROR	},
	{	ESRCH,		E_COMMAND_TERMINATED},
	{	ECHILD,		E_COMMAND_TERMINATED},
	{	EWOULDBLOCK,	E_DEVICE_ERROR	},
	{	EXDEV,		E_DEVICE_ERROR	},
	{	EALREADYEXISTS,	E_POLICY_ERROR	}
};


static	int	unix_to_rational(e)	int	e; 
{
	int	index;
	for (index = 0 ; index < sizeof(u_to_r) / sizeof (struct _s) ; index++)
		if (u_to_r[index].unix_error == e)
			return	u_to_r[index].rational_error;
	return	-1;
}

static	char	*error_str(e) int e; 
{
	if (e == E_OK)	return	"";
	else {
		if ((e>0) && (e<sys_nerr))
			return	sys_errlist[e];
		else	switch (e)	{
		case	EALREADYEXISTS:
			return	"Already Exists";
		default:
			return	"Invalid Error Number";
		}
	}
}

int	report_unix_error(fout,req,err)	int	req,err; 
{
	int	rat_error;
	rat_error = unix_to_rational(err);
	if (!acceptable(req,rat_error))	rat_error = E_INTERNAL_ERROR;
	if (rw_write_int(fout,F_ERROR) == -1)
		return	-1;
#ifdef	DEBUG
	trace_error(rat_error,error_str(err));
#endif
	if (rw_write_int(fout,rat_error) == -1)
		return -1;
	(void)b_flush(TRUE);
	if (rw_write_str(fout,error_str(err)) == -1)
		return	-1;
	return	rat_error;
}

int	report_rational_error(fout,req,err,str)
int	req,err;
char	*str; 
{
	if (!acceptable(req,err))	err = E_INTERNAL_ERROR;
	if (rw_write_int(fout,F_ERROR) == -1)
		return -1;
#ifdef	DEBUG
	trace_error(err,str);
#endif
	if (rw_write_int(fout,err) == -1)
		return -1;
	(void)b_flush(TRUE);
	if (rw_write_str(fout,str) == -1)
		return -1;
	return err;
}