getdomainname.c (2e18dcd969f2c454a96ec3c5f84acc0e0eb475d5) | getdomainname.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: @(#)gethostname.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: @(#)gethostname.c 8.1 (Berkeley) 6/4/93"; 37*/ 38static const char rcsid[] = |
39 "$Id$"; | 39 "$Id: getdomainname.c,v 1.1 1994/08/08 00:40:23 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 |
45long | 45#include <unistd.h> 46 47int |
46getdomainname(name, namelen) 47 char *name; 48 int namelen; 49{ 50 int mib[2]; 51 size_t size; 52 53 mib[0] = CTL_KERN; 54 mib[1] = KERN_DOMAINNAME; 55 size = namelen; 56 if (sysctl(mib, 2, name, &size, NULL, 0) == -1) 57 return (-1); 58 return (0); 59} | 48getdomainname(name, namelen) 49 char *name; 50 int namelen; 51{ 52 int mib[2]; 53 size_t size; 54 55 mib[0] = CTL_KERN; 56 mib[1] = KERN_DOMAINNAME; 57 size = namelen; 58 if (sysctl(mib, 2, name, &size, NULL, 0) == -1) 59 return (-1); 60 return (0); 61} |