Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2.1 of the GNU Lesser General Public License 00007 as published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this program; if not, write the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00023 USA. 00024 00025 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00026 Mountain View, CA 94043, or: 00027 00028 http://www.sgi.com 00029 00030 For further information regarding this notice, see: 00031 00032 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00033 00034 */ 00035 00036 00037 #pragma ident "@(#) libu/errmsg/lerror.c 92.1 06/25/99 17:24:37" 00038 00039 #ifdef _UNICOS 00040 #include <infoblk.h> 00041 #endif 00042 #include <liberrno.h> 00043 #include <stdlib.h> /* for exit() and abort() */ 00044 #include <errno.h> 00045 #include <stdio.h> 00046 #include <stdarg.h> 00047 00048 00049 #ifdef _CRAY2 00050 #pragma soft errfile 00051 extern FILE *errfile; 00052 #endif 00053 00054 /* 00055 * _lerror - library run-time error processor. This routine 00056 * acts upon an error status as requested in the 'hndlcode' 00057 * argument. The actions are as follows: 00058 * 00059 * MODE ACTION 00060 * 00061 * _LELVL_ABORT Print the error message and then abort with 00062 * traceback. On the YMP, a traceback will be 00063 * suppressed if _repriev is not loaded. 00064 * _LELVL_EXIT Print the error message and then call exit with 00065 * a nonzero status. This mode is used by commands. 00066 * _LELVL_MSG Print the error message and then return. 00067 * _LELVL_RETURN Return without printing anything. 00068 */ 00069 00070 void 00071 _lerror(int hndlcode, int errn, ...) 00072 { 00073 va_list args; /* Variable argument list */ 00074 00075 #ifdef _CRAY 00076 if (_numargs() < 1) 00077 (void) abort(); 00078 #endif 00079 if (hndlcode >= _LELVL_MSG && errn != 0) { 00080 va_start(args, errn); 00081 _lmessage(errn, NULL, args); /* Print error message */ 00082 va_end(args); 00083 } 00084 00085 if (hndlcode >= _LELVL_ABORT) { 00086 (void) abort(); /* abort causes traceback on CX/CEA */ 00087 } 00088 00089 if (hndlcode >= _LELVL_EXIT) 00090 (void) exit(1); 00091 }