* Copyright (c) 1983, 1988 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
"@(#) Copyright (c) 1983, 1988 Regents of the University of California.\n\
static char sccsid
[] = "@(#)hostid.c 5.5 (Berkeley) %G%";
u_long addr
, inet_addr();
long hostid
, gethostid();
printf("%#lx\n", gethostid());
if (hp
= gethostbyname(id
)) {
bcopy(hp
->h_addr
, &addr
, sizeof(addr
));
} else if (index(id
, '.')) {
if ((hostid
= inet_addr(id
)) == -1)
if (id
[0] == '0' && (id
[1] == 'x' || id
[1] == 'X'))
if (sscanf(id
, "%lx", &hostid
) != 1) {
usage
: fputs("usage: hostid [hexnum or internet address]\n",
if (sethostid(hostid
) < 0) {