00001 /* 00002 * Copyright 2004, 2005 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 1999-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. Further, any 00016 license provided herein, whether implied or otherwise, is limited to 00017 this program in accordance with the express provisions of the 00018 GNU Lesser General Public License. 00019 00020 Patent licenses, if any, provided herein do not apply to combinations 00021 of this program with other product or programs, or any other product 00022 whatsoever. This program is distributed without any warranty that the 00023 program is delivered free of the rightful claim of any third person by 00024 way of infringement or the like. 00025 00026 See the GNU Lesser General Public License for more details. 00027 00028 You should have received a copy of the GNU General Public License along 00029 with this program; if not, write the Free Software Foundation, Inc., 59 00030 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00031 00032 */ 00033 00034 /* $Header: /proj/osprey/CVS/open64/osprey1.0/libU77/hostnm_.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ 00035 /* 00036 * hostnm - return this machines hostname 00037 * @(#)hostnm_.c 1.1 00038 * 00039 * synopsis: 00040 * integer function hostnm (name) 00041 * character(*) name 00042 * 00043 * where: 00044 * name will receive the host name 00045 * The returned value will be 0 if successful, an error number otherwise. 00046 */ 00047 00048 #include <errno.h> 00049 #include <unistd.h> 00050 #include "externals.h" 00051 00052 #ifdef KEY /* Bug 1683 */ 00053 00054 #include "pathf90_libU_intrin.h" 00055 00056 pathf90_i4 00057 pathf90_hostnm(char *name, pathf90_i4 *status, int len) 00058 { 00059 char buf[64]; 00060 int blen = sizeof buf; 00061 pathf90_i4 junk; 00062 status = (0 == status) ? (&junk) : status; 00063 00064 if (gethostname (buf, blen) == 0) 00065 { 00066 b_char (buf, name, len); 00067 return (*status = 0); 00068 } 00069 else 00070 return(*status = errno); 00071 } 00072 00073 #else 00074 00075 extern int 00076 hostnm_ (char *name, int len) 00077 { 00078 char buf[64]; 00079 int blen = sizeof buf; 00080 00081 if (gethostname (buf, blen) == 0) 00082 { 00083 b_char (buf, name, len); 00084 return (0); 00085 } 00086 else 00087 return(errno); 00088 } 00089 00090 #endif /* KEY Bug 1683 */
1.5.6