=================================================================== RCS file: /cvs/texi2mdoc/main.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -p -r1.55 -r1.56 --- texi2mdoc/main.c 2015/03/01 00:25:07 1.55 +++ texi2mdoc/main.c 2015/03/01 13:39:51 1.56 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.55 2015/03/01 00:25:07 kristaps Exp $ */ +/* $Id: main.c,v 1.56 2015/03/01 13:39:51 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -990,6 +990,8 @@ dotitle(struct texi *p, enum texicmd cmd, size_t *pos) start = end = *pos; while (end < BUFSZ(p) && '\n' != BUF(p)[end]) end++; + if (end < BUFSZ(p)) + end++; advanceeoln(p, pos, 1); free(p->subtitle); p->subtitle = malloc(end - start + 1); @@ -1410,7 +1412,7 @@ dovalue(struct texi *p, enum texicmd cmd, size_t *pos) texiputchar(p, ' '); p->seenws = 0; if (NULL != (cp = valueblookup(p, pos))) - texisplice(p, cp, strlen(cp), pos); + texisplice(p, cp, strlen(cp), *pos); else texiputchars(p, "{No value}"); } else if (TEXICMD_IFCLEAR == cmd) { @@ -1577,7 +1579,7 @@ dosection(struct texi *p, enum texicmd cmd, size_t *po if (0 == sec && NULL != p->chapters) { teximdocclose(p, 0); - teximdocopen(p); + teximdocopen(p, pos); } teximacroopen(p, sects[sec]); @@ -1594,7 +1596,7 @@ dotop(struct texi *p, enum texicmd cmd, size_t *pos) texierr(p, "@top command while ignoring"); if (NULL == p->chapters) - teximdocopen(p); + teximdocopen(p, pos); dosection(p, cmd, pos); } @@ -1752,7 +1754,8 @@ doend(struct texi *p, enum texicmd cmd, size_t *pos) while (*pos < BUFSZ(p) && '\n' != BUF(p)[*pos]) advance(p, pos); - texiwarn(p, "unexpected \"end\": %.*s", (int)(*pos - start), &BUF(p)[start]); + texiwarn(p, "unexpected \"end\": %.*s", + (int)(*pos - start), &BUF(p)[start]); advanceeoln(p, pos, 1); } @@ -1899,7 +1902,7 @@ main(int argc, char *argv[]) } texiexit(&texi); - return(EXIT_FAILURE); + exit(EXIT_SUCCESS); usage: fprintf(stderr, "usage: %s [-Cdir] [-Idirs] [file]\n", progname); return(EXIT_FAILURE);