home *** CD-ROM | disk | FTP | other *** search
- static char sccs_id[] = "@(#) gethostname.c 1.2 " __DATE__ " HJR";
-
- /* gethostname.c (c) Copyright 1990 H.Rogers */
-
- #include <string.h>
- #include <errno.h>
-
- #include "sys/unix.h"
- #include "sys/os.h"
-
- /* gethostname() returns "acorn<station>" */
-
- char *
- gethostname (void)
- {
- int r[3];
- os_error *e;
- static char buf[8];
- static char hex[16] = "0123456789abcdef";
-
- strcpy (buf, "acorn");
- if (e = os_byte (0xa1, 0, 0, r))
- {
- __seterr (e);
- return (0);
- }
- buf[7] = 0;
- buf[6] = hex[r[1] & 0xf];
- buf[5] = hex[(r[1] >> 4) & 0xf];
-
- return (buf);
- }
-