00001 /* 00002 * Copyright 2004 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001, Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2.1 of the GNU Lesser General Public License 00011 as published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU Lesser General Public 00025 License along with this program; if not, write the Free Software 00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00027 USA. 00028 00029 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00030 Mountain View, CA 94043, or: 00031 00032 http://www.sgi.com 00033 00034 For further information regarding this notice, see: 00035 00036 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00037 00038 */ 00039 00040 00041 00042 #pragma ident "@(#) libf/fio/ferror.c 92.2 06/18/99 18:41:40" 00043 00044 #include <liberrno.h> 00045 #include <errno.h> 00046 #include <stdio.h> 00047 #include <stdarg.h> 00048 #include <stdlib.h> 00049 #include "fio.h" 00050 00051 #ifdef _CRAYMPP 00052 static DECL_MPP_LOCK(ferrlock) /* MPP: lock for _ferr() */ 00053 #endif 00054 00055 /* 00056 * _ferr - Fortran statement run-time error processor 00057 * 00058 * The funny ifdef'ing is used if _ferr is defined as a macro for 00059 * debugging purposes. 00060 */ 00061 void 00062 _ferr(FIOSPTR fiosp, int errn, ...) 00063 { 00064 va_list args; /* Variable argument list */ 00065 00066 #ifdef _UNICOS 00067 if (_numargs() < 2) 00068 abort(); 00069 #endif 00070 00071 MPP_LOCK(&ferrlock); /* MPP: allow only 1 PE in _ferr() */ 00072 00073 fflush(stdout); 00074 fflush(stderr); /* just in case */ 00075 00076 va_start(args, errn); 00077 00078 _lmessage(errn, NULL, args); /* Print error message */ 00079 00080 _fcontext(fiosp); /* Print error context */ 00081 00082 va_end(args); 00083 00084 #if defined(__mips) || defined(_LITTLE_ENDIAN) 00085 /* we don't have atabort() on Irix, but we do want to clean up */ 00086 /* the Fortran units before aborting */ 00087 _fcleanup(); 00088 #endif 00089 abort(); 00090 }
1.5.6