setdomainname.c (2e18dcd969f2c454a96ec3c5f84acc0e0eb475d5) | setdomainname.c (fba5b1cc9777dbe10a839d58450bce9a0d961b65) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) 35/* 36static char sccsid[] = "From: @(#)sethostname.c 8.1 (Berkeley) 6/4/93"; 37*/ 38static const char rcsid[] = | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) 35/* 36static char sccsid[] = "From: @(#)sethostname.c 8.1 (Berkeley) 6/4/93"; 37*/ 38static const char rcsid[] = |
39 "$Id$"; | 39 "$Id: setdomainname.c,v 1.1 1994/08/08 00:40:24 wollman Exp $"; |
40#endif /* LIBC_SCCS and not lint */ 41 42#include <sys/param.h> 43#include <sys/sysctl.h> 44 | 40#endif /* LIBC_SCCS and not lint */ 41 42#include <sys/param.h> 43#include <sys/sysctl.h> 44 |
45#if __STDC__ 46long | 45#include <unistd.h> 46 47int |
47setdomainname(const char *name, int namelen) | 48setdomainname(const char *name, int namelen) |
48#else 49long 50setdomainname(name, namelen) 51 char *name; 52 int namelen; 53#endif | |
54{ 55 int mib[2]; 56 57 mib[0] = CTL_KERN; 58 mib[1] = KERN_DOMAINNAME; 59 if (sysctl(mib, 2, NULL, NULL, (void *)name, namelen) == -1) 60 return (-1); 61 return (0); 62} | 49{ 50 int mib[2]; 51 52 mib[0] = CTL_KERN; 53 mib[1] = KERN_DOMAINNAME; 54 if (sysctl(mib, 2, NULL, NULL, (void *)name, namelen) == -1) 55 return (-1); 56 return (0); 57} |