00001 /* 00002 00003 Copyright (C) 1999-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. Further, any 00012 license provided herein, whether implied or otherwise, is limited to 00013 this program in accordance with the express provisions of the 00014 GNU Lesser General Public License. 00015 00016 Patent licenses, if any, provided herein do not apply to combinations 00017 of this program with other product or programs, or any other product 00018 whatsoever. This program is distributed without any warranty that the 00019 program is delivered free of the rightful claim of any third person by 00020 way of infringement or the like. 00021 00022 See the GNU Lesser General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 */ 00029 00030 /* --------------------------------------------------- */ 00031 /* | All Rights Reserved. | */ 00032 /* --------------------------------------------------- */ 00033 /* $Header: /proj/osprey/CVS/open64/osprey1.0/libU77/gethostname_.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ 00034 /* 00035 * gethostname - return this machines hostname 00036 * @(#)gethostname_.c 1.1 00037 * 00038 * synopsis: 00039 * integer function gethostname (name, len) 00040 * character(*) name 00041 * integer len 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 extern int 00053 gethostname_ (char *name, int *len, int ftnlen) 00054 { 00055 char buf[64]; 00056 int blen = sizeof buf; 00057 00058 if (gethostname (buf, blen) == 0) 00059 { 00060 b_char (buf, name, *len); 00061 return (0); 00062 } 00063 else 00064 return(-1); 00065 }
1.5.6