mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-02 10:42:45 +00:00
libfetch: use more portable getline() interface
this is for better portability in order to avoid using a function which is BSD-only or available via libbsd MFC after: 3 weeks
This commit is contained in:
parent
aa68b3bb2e
commit
ee3ca711a8
@ -1526,12 +1526,12 @@ http_get_proxy(struct url * url, const char *flags)
|
||||
static void
|
||||
http_print_html(FILE *out, FILE *in)
|
||||
{
|
||||
size_t len;
|
||||
char *line, *p, *q;
|
||||
size_t len = 0;
|
||||
char *line = NULL, *p, *q;
|
||||
int comment, tag;
|
||||
|
||||
comment = tag = 0;
|
||||
while ((line = fgetln(in, &len)) != NULL) {
|
||||
while (getline(&line, &len, in) >= 0) {
|
||||
while (len && isspace((unsigned char)line[len - 1]))
|
||||
--len;
|
||||
for (p = q = line; q < line + len; ++q) {
|
||||
@ -1559,6 +1559,8 @@ http_print_html(FILE *out, FILE *in)
|
||||
fwrite(p, q - p, 1, out);
|
||||
fputc('\n', out);
|
||||
}
|
||||
|
||||
free(line);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user