static char sccsid
[] = "@(#)htable.c 4.1 (Berkeley) %G%";
* htable - convert NIC host table into a UNIX format.
* NIC format is described in RFC 810, 1 March 1982.
fprintf(stderr
, "usage: %s [ input-file ]\n",
if (freopen(infile
, "r", stdin
) == NULL
) {
hf
= fopen("hosts", "w");
hf
= fopen("gateways", "w");
p
= malloc(strlen(str
) + 1);
do_entry(keyword
, addrlist
, namelist
, cputype
, opsys
, protos
)
struct name
*namelist
, *cputype
, *opsys
, *protos
;
register struct addr
*al
, *al2
;
register struct name
*nl
, *nl2
;
for (al
= addrlist
; al
; al
= al2
) {
if (net(al
->addr_val
) != LOCALNET
) {
fprintf(hf
, "%d.%d.%d.%d\t",
net(al
->addr_val
), host(al
->addr_val
),
lhost(al
->addr_val
), imp(al
->addr_val
));
for (nl
= namelist
; nl
; nl
= nl
->name_link
)
fprintf(hf
, " %s", lower(nl
->name_val
));
fprintf(stderr
, "Unknown keyword: %d.\n", keyword
);
for (nl
= namelist
; nl
; nl
= nl2
) {
for (nl
= protos
; nl
; nl
= nl2
) {
lhf
= fopen("localhosts", "r");
fprintf(stderr
, "(continuing)\n");
while (cc
= fread(buf
, 1, sizeof(buf
), lhf
))