error.c
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 145 行
C
145 行
#ifndef lintstatic CHTYPE *sccsid = "@(#)error.c 4.1 (Ultrix) 7/17/90";#endif lint/************************************************************************ * * * Copyright (c) 1986 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * This software is derived from software received from the * * University of California, Berkeley, and from Bell * * Laboratories. Use, duplication, or disclosure is subject to * * restrictions under license agreements with University of * * California and with AT&T. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************//* * * Modification History: * * 003 - David Lindner Wed Jul 26 10:22:10 EDT 1989 * Fixed badfilename bug * * 002 - Gary A. Gaudet, Wed Nov 9 10:24:49 EST 1988 * MIPS portability and bug fixes * * 001 - Gary Gaudet for Andy Gadsby 09-mar-88 * i18n version of csh *//* * UNIX shell * * Bell Telephone Laboratories * */#include "defs.h"/* ======== error handling ======== */failed(s1, s2)CHTYPE *s1, *s2;{ prp2(); /* DJL 003 */ prs_cntl(s1); if (s2) { prs(colon); prs(s2); } newline(); exitsh(ERROR);}error(s)CHTYPE *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 & (forked | errflg | ttyflg)) != ttyflg) done(); else { clearup(); restore(0); clear_buff(); execbrk = breakcnt = funcnt = 0; longjmp(errshell, 1); }}void /* DAG */done(){ register CHTYPE *t; if (t = trapcom[0]) { trapcom[0] = 0; execexp(t, 0); free(t); } else chktrap(); rmtemp(0); rmfunctmp();#ifdef ACCT doacct();#endif exit(exitval);}rmtemp(base)struct ionod *base;{ while (iotemp > base) { unlink(wtoc(iotemp->ioname)); free(iotemp->iolink); iotemp = iotemp->iolst; }}rmfunctmp(){ while (fiotemp) { unlink(wtoc(fiotemp->ioname)); fiotemp = fiotemp->iolst; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?