# 2.11BSD#431 - /usr/src/lib/libc/gen/gethostname.c

##### Functions

    gethostname       X

       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
       9:  *    notice, this list of conditions and the following disclaimer.
      10:  * 2. Redistributions in binary form must reproduce the above copyright
      11:  *    notice, this list of conditions and the following disclaimer in the
      12:  *    documentation and/or other materials provided with the distribution.
      13:  * 3. All advertising materials mentioning features or use of this software
      14:  *    must display the following acknowledgement:
      15:  *	This product includes software developed by the University of
      16:  *	California, Berkeley and its contributors.
      17:  * 4. Neither the name of the University nor the names of its contributors
      18:  *    may be used to endorse or promote products derived from this software
      19:  *    without specific prior written permission.
      20:  *
      21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
      22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
      23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
      24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
      25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
      26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
      27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
      28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
      30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
      31:  * SUCH DAMAGE.
      32:  */
      33:
      34: #if defined(LIBC_SCCS) && !defined(lint)
      35: static char sccsid[] = "@(#)gethostname.c	8.1.1 (2.11BSD) 1997/11/30";
      36: #endif /* LIBC_SCCS and not lint */
      37:
      38: #include <sys/param.h>
      39: #include <sys/sysctl.h>
      40:
      41: gethostname(name, namelen)
      42:     char *name;
      43:     int namelen;
      44: {
      45:     int mib[2];
      46:     size_t size;
      47:
      48:     mib[0] = CTL_KERN;
      49:     mib[1] = KERN_HOSTNAME;
      50:     size = namelen;
      51:     if (sysctl(mib, 2, name, &size, NULL, 0) == -1)
      52:         return (-1);
      53:     return (0);
      54: }

#### Defined functions

gethostname defined in line 41; used 69 times

- in /usr/src/bin/date.c line 295
- in /usr/src/bin/hostname/hostname.c line 79
- in /usr/src/bin/login/login.c line 118
- in /usr/src/bin/mail.c line 365
- in /usr/src/bin/tcsh/sh.types.h line 148
- in /usr/src/bin/tcsh/tc.os.h line 306
- in /usr/src/bin/wall.c line 55
- in /usr/src/bin/who.c line 61
- in /usr/src/bin/write.c line 151
- in /usr/src/games/atc/log.c line 113
- in /usr/src/games/hunt/driver.c line 210
- in /usr/src/games/hunt/hunt.c line 309
- in /usr/src/games/warp/intrp.c line 102
- in /usr/src/lib/libc/net/rcmd.c line 325
- in /usr/src/lib/libc/net/res_init.c line 116
- in /usr/src/libexec/comsat/comsat.c line 82
- in /usr/src/libexec/ftpd/ftpd.c line 243
- in /usr/src/libexec/getty/main.c line 121
- in /usr/src/libexec/popper/pop_init.c line 50
- in /usr/src/libexec/rlogind/rlogind.c line 620
- in /usr/src/libexec/rshd/rshd.c line 443
- in /usr/src/libexec/talkd/talkd.c line 54
- in /usr/src/libexec/telnetd/telnetd.c line 427
- in /usr/src/local/welcome/welcome.c line 94
- in /usr/src/new/ansi/ansitape.c line 59
- in /usr/src/new/crash/inet.c line 371
- in /usr/src/new/crash/route.c line 213
- in /usr/src/new/kermit5.188/ckuusx.c line 433
- in /usr/src/new/nntp/inews/uname.c line 38
- in /usr/src/new/nntp/server/serve.c line 130
- in /usr/src/new/notes/src/startup.c line 133
- in /usr/src/new/rn/intrp.c line 130
- in /usr/src/sbin/route/route.c line 213
- in /usr/src/sbin/shutdown/shutdown.c line 115
- in /usr/src/ucb/PORT/systat/main.c line 116
- in /usr/src/ucb/ex/expreserve.c line 329
- in /usr/src/ucb/ftp/ruserpass.c line 84
- in /usr/src/ucb/lock/lock.c line 98
- in /usr/src/ucb/netstat/inet.c line 385
- in /usr/src/ucb/netstat/route.c line 180
- in /usr/src/ucb/rdist/main.c line 69
- in /usr/src/ucb/talk/get_names.c line 47
- in /usr/src/usr.bin/uucp/uucpname.c line 59-61(2)
- in /usr/src/usr.lib/libU77/hostnm_.c line 32
- in /usr/src/usr.sbin/cron/do_command.c line 338
- in /usr/src/usr.sbin/lpr/displayq.c line 89
- in /usr/src/usr.sbin/lpr/lpd.c line 63
- in /usr/src/usr.sbin/lpr/lpq.c line 65
- in /usr/src/usr.sbin/lpr/lpr.c line 98
- in /usr/src/usr.sbin/lpr/lprm.c line 52
- in /usr/src/usr.sbin/lpr/printjob.c line 325, 1059
- in /usr/src/usr.sbin/named/tools/nslookup/main.c line 330
- in /usr/src/usr.sbin/ntp/ntpdc.c line 125
- in /usr/src/usr.sbin/rwhod/rwhod.c line 114
- in /usr/src/usr.sbin/sendmail.MX/src/daemon.c line 462, 554
- in /usr/src/usr.sbin/sendmail/aux/4.1a_daemon.c line 395
- in /usr/src/usr.sbin/sendmail/aux/uname.c line 16
- in /usr/src/usr.sbin/sendmail/src/daemon.c line 462, 554
- in /usr/src/usr.sbin/syslogd/syslogd.c line 230
- in /usr/src/usr.sbin/timed/cmds.c line 64, 142, 239, 283
- in /usr/src/usr.sbin/timed/timed.c line 215
- in /usr/src/usr.sbin/traceroute/traceroute.c line 759

#### Defined variables

sccsid defined in line 35; never used

Last modified: 1997-12-01 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 651 |