/* inet_addr.c 4.2 82/10/05 */
* Internet address interpretation routine.
* All the network library routines call this
* routine to interpret entries in the data bases
* which are expected to be an address.
register unsigned long val
, base
, n
;
unsigned long parts
[4], *pp
= parts
;
if (*cp
== 'x' || *cp
== 'X')
val
= (val
* base
) + (c
- '0');
if (base
== 16 && isxdigit(c
)) {
val
= (val
<< 4) + (c
+ 10 - (islower(c
) ? 'a' : 'A'));
* a.b.c (with c treated as 16-bits)
* a.b (with b treated as 24 bits)
if (*cp
&& !isspace(*cp
))
val
|= (parts
[1] & 0xff) << 16;
val
|= (parts
[2] & 0xff) << 8;