|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: * ! 6: * @(#)hostnm_.c 5.1 6/7/85 ! 7: */ ! 8: ! 9: /* ! 10: * hostnm - return this machines hostname ! 11: * ! 12: * synopsis: ! 13: * integer function hostnm (name) ! 14: * character(*) name ! 15: * ! 16: * where: ! 17: * name will receive the host name ! 18: * The returned value will be 0 if successful, an error number otherwise. ! 19: */ ! 20: ! 21: extern int errno; ! 22: ! 23: long ! 24: hostnm_ (name, len) ! 25: char *name; ! 26: long len; ! 27: { ! 28: char buf[64]; ! 29: register char *bp; ! 30: int blen = sizeof buf; ! 31: ! 32: if (gethostname (buf, blen) == 0) ! 33: { ! 34: b_char (buf, name, len); ! 35: return (0L); ! 36: } ! 37: else ! 38: return((long)errno); ! 39: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.