mirror of
https://github.com/opnsense/src.git
synced 2026-05-25 02:35:01 -04: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 (cherry picked from commitee3ca711a8) (cherry picked from commit635eb7ac79)
This commit is contained in:
parent
cae17ea368
commit
037c2f4fe3
1 changed files with 6 additions and 3 deletions
|
|
@ -1526,12 +1526,13 @@ 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;
|
||||
ssize_t len = 0;
|
||||
size_t cap;
|
||||
char *line = NULL, *p, *q;
|
||||
int comment, tag;
|
||||
|
||||
comment = tag = 0;
|
||||
while ((line = fgetln(in, &len)) != NULL) {
|
||||
while ((len = getline(&line, &cap, in)) >= 0) {
|
||||
while (len && isspace((unsigned char)line[len - 1]))
|
||||
--len;
|
||||
for (p = q = line; q < line + len; ++q) {
|
||||
|
|
@ -1559,6 +1560,8 @@ http_print_html(FILE *out, FILE *in)
|
|||
fwrite(p, q - p, 1, out);
|
||||
fputc('\n', out);
|
||||
}
|
||||
|
||||
free(line);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue