Reference domainname(1), and check for too many arguments.
This commit is contained in:
parent
667b5ea158
commit
ea92d19cb0
|
@ -30,7 +30,7 @@
|
|||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)hostname.1 8.1 (Berkeley) 5/31/93
|
||||
.\" $Id: hostname.1,v 1.6 1994/09/22 09:25:20 mycroft Exp $
|
||||
.\" $Id: hostname.1,v 1.7 1994/09/22 09:41:26 mycroft Exp $
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dt HOSTNAME 1
|
||||
|
@ -58,9 +58,8 @@ Trims off any domain information from the printed
|
|||
name.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr getdomainname 2 ,
|
||||
.Xr domainname 1 ,
|
||||
.Xr gethostname 2 ,
|
||||
.Xr setdomainname 2 ,
|
||||
.Xr sethostname 2
|
||||
.Sh HISTORY
|
||||
The
|
||||
|
|
|
@ -39,7 +39,7 @@ static char copyright[] =
|
|||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)hostname.c 8.1 (Berkeley) 5/31/93";*/
|
||||
static char *rcsid = "$Id: hostname.c,v 1.6 1994/09/22 09:25:22 mycroft Exp $";
|
||||
static char *rcsid = "$Id: hostname.c,v 1.7 1994/09/22 09:41:28 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -53,7 +53,7 @@ static char *rcsid = "$Id: hostname.c,v 1.6 1994/09/22 09:25:22 mycroft Exp $";
|
|||
void usage __P((void));
|
||||
|
||||
int
|
||||
main(argc,argv)
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
@ -73,6 +73,9 @@ main(argc,argv)
|
|||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc > 1)
|
||||
usage();
|
||||
|
||||
if (*argv) {
|
||||
if (sethostname(*argv, strlen(*argv)))
|
||||
err(1, "sethostname");
|
||||
|
|
Loading…
Reference in New Issue