diff options
-rw-r--r-- | badroff.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -56,7 +56,7 @@ char* cmd(void){ if (!strncmp(dat, "CT ", 3)){ return center(dat+3); } - return ""; + return NULL; } char* typeset(void){ @@ -68,13 +68,12 @@ char* line(void){ if ( (sz = fillbuf(2)) == 0) return ""; char* twobytes = peekstrbuf(inbuf, 0, 2); // .., .\n, or ^.? - if (sz == 1) return typeset(); - if (twobytes[0] == '.' && twobytes[1] == '\n') return typeset(); + if (sz == 1 || twobytes[1] == '\n') return typeset(); if (twobytes[0] == '.') popchrbuf(inbuf); if (twobytes[0] == '.' && twobytes[1] != '.'){ char* data = cmd(); - if (data[0] != '\0') return data; - else return line(); + if (data) return data; + return line(); } else { return typeset(); } @@ -93,4 +92,5 @@ int main(int argc, char** argv){ printf("%s",out); } fclose(in); + return 0; } |