fixes from wnj to allow job names to be globbed
[unix-history] / usr / src / bin / hostname / hostname.c
CommitLineData
65ed1a40 1static char *sccsid = "@(#)hostname.c 1.3 1.3 83/03/30";
d3d3fc37
KS
2/*
3 * hostname -- get (or set hostname)
4 */
5#include <stdio.h>
6
7char hostname[32];
8extern int errno;
9
10main(argc,argv)
64c52cbb 11 char *argv[];
d3d3fc37 12{
65ed1a40
RH
13 int myerrno;
14
d3d3fc37
KS
15 argc--;
16 argv++;
64c52cbb
SL
17 if (argc) {
18 if (sethostname(*argv,strlen(*argv)))
d3d3fc37 19 perror("sethostname");
65ed1a40 20 myerrno = errno;
d3d3fc37
KS
21 } else {
22 gethostname(hostname,sizeof(hostname));
65ed1a40 23 myerrno = errno;
d3d3fc37
KS
24 printf("%s\n",hostname);
25 }
65ed1a40 26 exit(myerrno);
d3d3fc37 27}