Commit | Line | Data |
---|---|---|
ad01bced DW |
1 | /* |
2 | * hostnm - return this machines hostname | |
3 | * @(#)hostnm_.c 1.1 | |
4 | * | |
5 | * synopsis: | |
6 | * integer function hostnm (name) | |
7 | * character(*) name | |
8 | * | |
9 | * where: | |
10 | * name will receive the host name | |
11 | * The returned value will be 0 if successful, an error number otherwise. | |
12 | */ | |
13 | ||
14 | extern int errno; | |
15 | ||
16 | long | |
17 | hostnm_ (name, len) | |
18 | char *name; | |
19 | long len; | |
20 | { | |
21 | char buf[64]; | |
22 | register char *bp; | |
23 | int blen = sizeof buf; | |
24 | ||
25 | if (gethostname (buf, blen) == 0) | |
26 | { | |
27 | b_char (buf, name, len); | |
28 | return (0L); | |
29 | } | |
30 | else | |
31 | return((long)errno); | |
32 | } |