txt2html

Converts plaintext to HTML
git clone git://src.gearsix.net/txt2html
Log | Files | Refs | Atom | README

commit c233c77c198d5e32e816fd21137441366208d505
parent cfec299f36a2e4716f36d70268cba8e4ddd07990
Author: gearsix <gearsix@tuta.io>
Date:   Tue,  7 Sep 2021 10:47:38 +0100

cleanup in parsef

Diffstat:
Mtxt2html.c | 10+++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/txt2html.c b/txt2html.c @@ -148,19 +148,15 @@ int main(int argc, char **argv) struct node *parsef(FILE **f) { - char c; + int n; struct node *ast = NULL; do { verbose("reading block...\r"); char buf[BUFSIZ] = {'\0'}; - fread(buf, BUFSIZ-1, sizeof(char), *f); + n = fread(buf, BUFSIZ-1, sizeof(char), *f); ast = buf2ast(buf, ast); - - c = fgetc(*f); - if (c != EOF && ungetc(c, *f) == EOF) - perror("txt2html: ungetc() fail"); verbose(" \r"); - } while (c != EOF); + } while (n > 0); buf2ast(NULL, ast); return ast; }