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 "@(#) libf/pxf/pxfuname.c 92.1 06/29/99 11:36:06" 00038 00039 #include <errno.h> 00040 #include <fortran.h> 00041 #include <liberrno.h> 00042 #include <string.h> 00043 #include <sys/utsname.h> 00044 #include "pxfstruct.h" 00045 #include "table.h" 00046 00047 /* 00048 * PXFUNAME PXF interface to the uname(2) system call 00049 * to return name(s) of current operating system 00050 * 00051 * Call from Fortran: 00052 * 00053 * SUBROUTINE PXFUNAME (JUNAMBUF, IERROR) 00054 * INTEGER JUNAMBUF, IERROR 00055 * 00056 * Where: 00057 * 00058 * JUNAMBUF is an input integer variable or array element 00059 * containing the pointer to the utsname structure. 00060 * 00061 * IERROR is an output integer variable that will contain the 00062 * status: 00063 * 00064 * Zero - PXFUNAME is successful, i.e., the 00065 * requested operating system information 00066 * was returned. 00067 * 00068 * Nonzero - PXFUNAME is not successful. 00069 * 00070 * EBADHANDLE If JUNAMBUF is invalid. 00071 * 00072 */ 00073 00074 #ifdef _UNICOS 00075 void 00076 PXFUNAME( 00077 #else 00078 void 00079 _PXFUNAME( 00080 #endif 00081 _f_int *JUNAMBUF, /* handle for struct utsname */ 00082 _f_int *IERROR) /* error status */ 00083 { 00084 struct utsname *utn; 00085 int errsts = 0; 00086 struct pxfhandle pxfhand; 00087 00088 pxfhand = _pxfhandle_table_lookup(&_pxfhandle_table, *JUNAMBUF); 00089 if (pxfhand.pxfstructptr == NULL || pxfhand.pxftype != PXF_UNAMBUF) { 00090 *IERROR = EBADHANDLE; 00091 return; 00092 } 00093 00094 utn = pxfhand.pxfstructptr; 00095 if (uname (utn) == -1) 00096 errsts = errno; 00097 *IERROR = errsts; 00098 } 00099 00100 00101 #ifndef _UNICOS 00102 void 00103 pxfuname_( 00104 _f_int *JUNAMBUF, 00105 _f_int *IERROR 00106 ) 00107 { 00108 _PXFUNAME(JUNAMBUF, IERROR); 00109 } 00110 #endif
1.5.6