Commit | Line | Data |
---|---|---|
64c52cbb | 1 | static char *sccsid = "@(#)hostname.c 1.2 1.2 83/01/02"; |
d3d3fc37 KS |
2 | /* |
3 | * hostname -- get (or set hostname) | |
4 | */ | |
5 | #include <stdio.h> | |
6 | ||
7 | char hostname[32]; | |
8 | extern int errno; | |
9 | ||
10 | main(argc,argv) | |
64c52cbb | 11 | char *argv[]; |
d3d3fc37 KS |
12 | { |
13 | argc--; | |
14 | argv++; | |
64c52cbb SL |
15 | if (argc) { |
16 | if (sethostname(*argv,strlen(*argv))) | |
d3d3fc37 KS |
17 | perror("sethostname"); |
18 | } else { | |
19 | gethostname(hostname,sizeof(hostname)); | |
20 | printf("%s\n",hostname); | |
21 | } | |
64c52cbb | 22 | exit(errno); |
d3d3fc37 | 23 | } |