new copyright notice
[unix-history] / usr / src / lib / libc / net / inet.3
index eecdad3..e1f4f78 100644 (file)
@@ -1,19 +1,24 @@
-.\" Copyright (c) 1983 Regents of the University of California.
-.\" All rights reserved.  The Berkeley software License Agreement
-.\" specifies the terms and conditions for redistribution.
+.\" Copyright (c) 1983, 1990 The Regents of the University of California.
+.\" All rights reserved.
 .\"
 .\"
-.\"    @(#)inet.3      6.6 (Berkeley) %G%
+.\" %sccs.include.redist.man%
 .\"
 .\"
-.TH INET 3N ""
+.\"    @(#)inet.3      6.9 (Berkeley) %G%
+.\"
+.TH INET 3 ""
 .UC 5
 .SH NAME
 .UC 5
 .SH NAME
-inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof, inet_netof \- Internet address manipulation routines
+inet_aton, inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof, inet_netof \- Internet address manipulation routines
 .SH SYNOPSIS
 .nf
 .B "#include <sys/socket.h>
 .B "#include <netinet/in.h>
 .B "#include <arpa/inet.h>
 .PP
 .SH SYNOPSIS
 .nf
 .B "#include <sys/socket.h>
 .B "#include <netinet/in.h>
 .B "#include <arpa/inet.h>
 .PP
+.B "int inet_aton(cp, pin)
+.B "char *cp;
+.B "struct in_addr *pin;
+.PP
 .B "unsigned long inet_addr(cp)
 .B "char *cp;
 .PP
 .B "unsigned long inet_addr(cp)
 .B "char *cp;
 .PP
@@ -34,14 +39,27 @@ inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof, inet_netof \- Int
 .fi
 .SH DESCRIPTION
 The routines
 .fi
 .SH DESCRIPTION
 The routines
+.IR inet_aton ,
 .I inet_addr
 and
 .I inet_network
 .I inet_addr
 and
 .I inet_network
-each interpret character strings representing
+interpret character strings representing
 numbers expressed in the Internet standard \*(lq.\*(rq
 numbers expressed in the Internet standard \*(lq.\*(rq
-notation, returning numbers suitable for use
+notation.
+The
+.I inet_aton
+routine interprets the specified character string as an Internet address,
+placing the address into the structure provided.
+It returns 1 if the string was successfully interpreted,
+or 0 if the string is invalid.
+The
+.I inet_addr
+and
+.I inet_network
+functions return numbers suitable for use
 as Internet addresses and Internet network
 as Internet addresses and Internet network
-numbers, respectively.  The routine
+numbers, respectively.
+The routine
 .I inet_ntoa
 takes an Internet address and returns an ASCII
 string representing the address in \*(lq.\*(rq
 .I inet_ntoa
 takes an Internet address and returns an ASCII
 string representing the address in \*(lq.\*(rq
@@ -57,7 +75,7 @@ break apart Internet host addresses, returning
 the network number and local network address part,
 respectively.
 .PP
 the network number and local network address part,
 respectively.
 .PP
-All Internet address are returned in network
+All Internet addresses are returned in network
 order (bytes ordered from left to right).
 All network numbers and local address parts are
 returned as machine format integer values.
 order (bytes ordered from left to right).
 All network numbers and local address parts are
 returned as machine format integer values.
@@ -82,7 +100,7 @@ ordered from right to left.
 .PP
 When a three part address is specified, the last
 part is interpreted as a 16-bit quantity and placed
 .PP
 When a three part address is specified, the last
 part is interpreted as a 16-bit quantity and placed
-in the right most two bytes of the network address.
+in the right-most two bytes of the network address.
 This makes the three part address format convenient
 for specifying Class B network addresses as
 \*(lq128.net.host\*(rq.
 This makes the three part address format convenient
 for specifying Class B network addresses as
 \*(lq128.net.host\*(rq.
@@ -104,7 +122,7 @@ in the C language (i.e., a leading 0x or 0X implies
 hexadecimal; otherwise, a leading 0 implies octal;
 otherwise, the number is interpreted as decimal).
 .SH "SEE ALSO"
 hexadecimal; otherwise, a leading 0 implies octal;
 otherwise, the number is interpreted as decimal).
 .SH "SEE ALSO"
-gethostbyname(3N), getnetent(3N), hosts(5), networks(5),
+gethostbyname(3), getnetent(3), hosts(5), networks(5),
 .SH DIAGNOSTICS
 The constant \fBINADDR_NONE\fP is returned by
 .I inet_addr
 .SH DIAGNOSTICS
 The constant \fBINADDR_NONE\fP is returned by
 .I inet_addr
@@ -112,9 +130,14 @@ and
 .I inet_network
 for malformed requests.
 .SH BUGS
 .I inet_network
 for malformed requests.
 .SH BUGS
+The value INADDR_NONE (0xffffffff) is a valid broadcast address, but
+.I inet_addr
+cannot return that value without indicating failure.
+The newer
+.I inet_aton
+function does not share this problem.
 The problem of host byte ordering versus network byte ordering is
 The problem of host byte ordering versus network byte ordering is
-confusing.  A simple way to specify Class C network addresses in a manner
-similar to that for Class B and Class A is needed.
+confusing.
 The string returned by
 .I inet_ntoa
 resides in a static memory area.
 The string returned by
 .I inet_ntoa
 resides in a static memory area.