* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
* %sccs.include.redist.c%
static char copyright
[] =
"@(#) Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n";
static char sccsid
[] = "@(#)hostname.c 8.1 (Berkeley) %G%";
char *p
, hostname
[MAXHOSTNAMELEN
];
while ((ch
= getopt(argc
, argv
, "s")) != EOF
)
"usage: hostname [-s] [hostname]\n");
if (sethostname(*argv
, strlen(*argv
)))
if (gethostname(hostname
, sizeof(hostname
)))
if (sflag
&& (p
= strchr(hostname
, '.')))
(void)printf("%s\n", hostname
);