/* getnetent.c 4.1 82/08/25 */
static char *NETDB
= "/usr/lib/networks";
static FILE *netf
= NULL
;
static char line
[BUFSIZ
+1];
static struct netent net
;
static char *net_aliases
[MAXALIASES
];
static unsigned long value();
netf
= fopen(NETDB
, "r" );
if (netf
== NULL
&& (netf
= fopen(NETDB
, "r" )) == NULL
)
p
= fgets(line
, BUFSIZ
, netf
);
while (*cp
== ' ' || *cp
== '\t')
net
.n_aliases
= net_aliases
;
if (*cp
== ' ' || *cp
== '\t') {
if (q
< &net_aliases
[MAXALIASES
- 1])
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;
for (mp
= match
; *mp
; mp
++)