use err/warn(3); getbsize no longer needs the program name
[unix-history] / usr / src / lib / libc / gen / sethostname.c
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* %sccs.include.redist.c%
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)sethostname.c 5.2 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/sysctl.h>
#if __STDC__
long
sethostname(const char *name, int namelen)
#else
long
sethostname(name, namelen)
char *name;
int namelen;
#endif
{
int mib[2];
mib[0] = CTL_KERN;
mib[1] = KERN_HOSTNAME;
if (sysctl(mib, 2, NULL, NULL, (void *)name, namelen) == -1)
return (-1);
return (0);
}