version 1.16, 2000/04/14 10:30:31 |
version 1.17, 2000/04/26 20:56:29 |
|
|
for (cp = *cpp; *cp == ' ' || *cp == '\t'; cp++) |
for (cp = *cpp; *cp == ' ' || *cp == '\t'; cp++) |
; |
; |
|
|
/* Get number of bits. */ |
bits = key_read(ret, &cp); |
if (*cp < '0' || *cp > '9') |
if (bits == 0) |
return 0; /* Bad bit count... */ |
|
for (bits = 0; *cp >= '0' && *cp <= '9'; cp++) |
|
bits = 10 * bits + *cp - '0'; |
|
|
|
if (!key_read(ret, bits, &cp)) |
|
return 0; |
return 0; |
|
|
/* Skip trailing whitespace. */ |
/* Skip trailing whitespace. */ |
|
|
{ |
{ |
FILE *f; |
FILE *f; |
int success = 0; |
int success = 0; |
|
|
if (key == NULL) |
if (key == NULL) |
return 1; |
return 1; /* XXX ? */ |
|
|
/* Open the file for appending. */ |
|
f = fopen(filename, "a"); |
f = fopen(filename, "a"); |
if (!f) |
if (!f) |
return 0; |
return 0; |
|
|
fprintf(f, "%s ", host); |
fprintf(f, "%s ", host); |
if (key_write(key, f)) { |
if (key_write(key, f)) { |
fprintf(f, "\n"); |
|
success = 1; |
success = 1; |
} else { |
} else { |
error("add_host_to_hostfile: saving key failed"); |
error("add_host_to_hostfile: saving key in %s failed", filename); |
} |
} |
|
fprintf(f, "\n"); |
/* Close the file. */ |
|
fclose(f); |
fclose(f); |
return success; |
return success; |
} |
} |