Files
Arquivotheca.Solaris-2.5/cmd/sh/error.c
seta75D 7c4988eac0 Init
2021-10-11 19:38:01 -03:00

104 lines
1.4 KiB
C
Executable File

/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)error.c 1.7 92/07/14 SMI" /* SVr4.0 1.9.5.1 */
/*
* UNIX shell
*/
#include "defs.h"
/* ======== error handling ======== */
extern void done();
failed(s1, s2)
unsigned char *s1, *s2;
{
prp();
prs_cntl(s1);
if (s2)
{
prs(colon);
prs(s2);
}
newline();
exitsh(ERROR);
}
error(s)
unsigned char *s;
{
failed(s, NIL);
}
exitsh(xno)
int xno;
{
/*
* Arrive here from `FATAL' errors
* a) exit command,
* b) default trap,
* c) fault with no trap set.
*
* Action is to return to command level or exit.
*/
exitval = xno;
flags |= eflag;
if ((flags & (forcexit | forked | errflg | ttyflg)) != ttyflg)
done(0);
else
{
clearup();
restore(0);
(void)setb(1);
execbrk = breakcnt = funcnt = 0;
longjmp(errshell, 1);
}
}
rmtemp(base)
struct ionod *base;
{
while (iotemp > base)
{
unlink(iotemp->ioname);
free(iotemp->iolink);
iotemp = iotemp->iolst;
}
}
rmfunctmp()
{
while (fiotemp)
{
unlink(fiotemp->ioname);
fiotemp = fiotemp->iolst;
}
}
failure(s1, s2)
unsigned char *s1, *s2;
{
prp();
prs_cntl(s1);
if (s2)
{
prs(colon);
prs(s2);
}
newline();
if (flags & errflg)
exitsh(ERROR);
flags |= eflag;
exitval = ERROR;
exitset();
}