setdomainname.c (17145) | setdomainname.c (17282) |
---|---|
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: setdomainname.c,v 1.1 1994/08/08 00:40:24 wollman Exp $"; | 39 "$Id: setdomainname.c,v 1.2 1996/07/12 19:55:20 wollman Exp $"; |
40#endif /* LIBC_SCCS and not lint */ 41 42#include <sys/param.h> 43#include <sys/sysctl.h> 44 45#include <unistd.h> 46 47int 48setdomainname(const char *name, int namelen) 49{ 50 int mib[2]; 51 52 mib[0] = CTL_KERN; | 40#endif /* LIBC_SCCS and not lint */ 41 42#include <sys/param.h> 43#include <sys/sysctl.h> 44 45#include <unistd.h> 46 47int 48setdomainname(const char *name, int namelen) 49{ 50 int mib[2]; 51 52 mib[0] = CTL_KERN; |
53 mib[1] = KERN_DOMAINNAME; | 53 mib[1] = KERN_NISDOMAINNAME; |
54 if (sysctl(mib, 2, NULL, NULL, (void *)name, namelen) == -1) 55 return (-1); 56 return (0); 57} | 54 if (sysctl(mib, 2, NULL, NULL, (void *)name, namelen) == -1) 55 return (-1); 56 return (0); 57} |