1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)hostnm_.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 /* 13 * hostnm - return this machines hostname 14 * 15 * synopsis: 16 * integer function hostnm (name) 17 * character(*) name 18 * 19 * where: 20 * name will receive the host name 21 * The returned value will be 0 if successful, an error number otherwise. 22 */ 23 24 extern int errno; 25 26 long 27 hostnm_ (name, len) 28 char *name; 29 long len; 30 { 31 char buf[64]; 32 register char *bp; 33 int blen = sizeof buf; 34 35 if (gethostname (buf, blen) == 0) 36 { 37 b_char (buf, name, len); 38 return (0L); 39 } 40 else 41 return((long)errno); 42 } 43