Print this page
4023 - Typo in file(1) manpage and various others
   1 '\" te
   2 .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
   3 .\" Copyright 1989 AT&T.
   4 .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved
   5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   6 .\" http://www.opengroup.org/bookstore/.
   7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   8 .\"  This notice shall appear on any product containing this material.
   9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  12 .TH GETHOSTBYNAME 3NSL "Aug 24, 2007"
  13 .SH NAME
  14 gethostbyname, gethostbyname_r, gethostbyaddr, gethostbyaddr_r, gethostent,
  15 gethostent_r, sethostent, endhostent \- get network host entry
  16 .SH SYNOPSIS
  17 .LP
  18 .nf
  19 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lnsl\fR [ \fIlibrary\fR... ]
  20 #include <netdb.h>
  21 
  22 \fBstruct hostent *\fR\fBgethostbyname\fR(\fBconst char *\fR\fIname\fR);
  23 .fi
  24 
  25 .LP
  26 .nf
  27 \fBstruct hostent *\fR\fBgethostbyname_r\fR(\fBconst char *\fR\fIname\fR,
  28      \fBstruct hostent *\fR\fIresult\fR, \fBchar *\fR\fIbuffer\fR, \fBint\fR \fIbuflen\fR,
  29      \fBint *\fR\fIh_errnop\fR);
  30 .fi
  31 
  32 .LP


 264         if (argc != 2) {
 265             (void) printf("usage: %s IP-address\en", argv[0]);
 266             exit (1);
 267         }
 268         if ((int)(addr = inet_addr(argv[1])) == -1) {
 269             (void) printf("IP-address must be of the form a.b.c.d\en");
 270             exit (2);
 271         }
 272         hp = gethostbyaddr((char *)&addr, 4, AF_INET);
 273         if (hp == NULL) {
 274             (void) printf("host information for %s not found\en", argv[1]);
 275             exit (3);
 276         }
 277         for (p = hp->h_addr_list; *p != 0; p++) {
 278             struct in_addr in;
 279             char **q;
 280             (void) memcpy(&in.s_addr, *p, sizeof (in.s_addr));
 281          (void) printf("%s\t%s", inet_ntoa(in), hp\(mi>h_name);
 282             for (q = hp->h_aliases; *q != 0; q++)
 283                 (void) printf(" %s", *q);
 284             (void) putchar('\n');
 285         }
 286         exit (0);
 287 }
 288 .fi
 289 .in -2
 290 
 291 .sp
 292 .LP
 293 Note that the preceding sample program is unsafe for use in multithreaded
 294 applications.
 295 
 296 .SH FILES
 297 .sp
 298 .ne 2
 299 .na
 300 \fB\fB/etc/hosts\fR\fR
 301 .ad
 302 .RS 22n
 303 hosts file that associates the names of hosts with their Internet Protocol (IP)
 304 addresses


   1 '\" te
   2 .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
   3 .\" Copyright 1989 AT&T.
   4 .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved
   5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   6 .\" http://www.opengroup.org/bookstore/.
   7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   8 .\"  This notice shall appear on any product containing this material.
   9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  12 .TH GETHOSTBYNAME 3NSL "Sep 10, 2013"
  13 .SH NAME
  14 gethostbyname, gethostbyname_r, gethostbyaddr, gethostbyaddr_r, gethostent,
  15 gethostent_r, sethostent, endhostent \- get network host entry
  16 .SH SYNOPSIS
  17 .LP
  18 .nf
  19 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lnsl\fR [ \fIlibrary\fR... ]
  20 #include <netdb.h>
  21 
  22 \fBstruct hostent *\fR\fBgethostbyname\fR(\fBconst char *\fR\fIname\fR);
  23 .fi
  24 
  25 .LP
  26 .nf
  27 \fBstruct hostent *\fR\fBgethostbyname_r\fR(\fBconst char *\fR\fIname\fR,
  28      \fBstruct hostent *\fR\fIresult\fR, \fBchar *\fR\fIbuffer\fR, \fBint\fR \fIbuflen\fR,
  29      \fBint *\fR\fIh_errnop\fR);
  30 .fi
  31 
  32 .LP


 264         if (argc != 2) {
 265             (void) printf("usage: %s IP-address\en", argv[0]);
 266             exit (1);
 267         }
 268         if ((int)(addr = inet_addr(argv[1])) == -1) {
 269             (void) printf("IP-address must be of the form a.b.c.d\en");
 270             exit (2);
 271         }
 272         hp = gethostbyaddr((char *)&addr, 4, AF_INET);
 273         if (hp == NULL) {
 274             (void) printf("host information for %s not found\en", argv[1]);
 275             exit (3);
 276         }
 277         for (p = hp->h_addr_list; *p != 0; p++) {
 278             struct in_addr in;
 279             char **q;
 280             (void) memcpy(&in.s_addr, *p, sizeof (in.s_addr));
 281          (void) printf("%s\t%s", inet_ntoa(in), hp\(mi>h_name);
 282             for (q = hp->h_aliases; *q != 0; q++)
 283                 (void) printf(" %s", *q);
 284             (void) putchar('\en');
 285         }
 286         exit (0);
 287 }
 288 .fi
 289 .in -2
 290 
 291 .sp
 292 .LP
 293 Note that the preceding sample program is unsafe for use in multithreaded
 294 applications.
 295 
 296 .SH FILES
 297 .sp
 298 .ne 2
 299 .na
 300 \fB\fB/etc/hosts\fR\fR
 301 .ad
 302 .RS 22n
 303 hosts file that associates the names of hosts with their Internet Protocol (IP)
 304 addresses