diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-03-31 13:50:19 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-03-31 13:50:19 +0000 |
commit | e487e44b52bbc7bfdb77346cc9a44d1a7c825d2c (patch) | |
tree | 643e3b4494b73a5ef92844c79270118743dd2b96 /main.c | |
parent | 1cc03ab30aeb29ce86c06ab8fca7da9056992cef (diff) | |
download | mandoc-e487e44b52bbc7bfdb77346cc9a44d1a7c825d2c.tar.gz |
General clean-ups.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -220,6 +220,8 @@ main(int argc, char *argv[]) if (fflags & IGN_MACRO) pflags |= MDOC_IGN_MACRO; mdoc = mdoc_alloc(&curp, pflags, &mdoccb); + if (NULL == mdoc) + errx(1, "memory exhausted"); break; } @@ -246,8 +248,10 @@ main(int argc, char *argv[]) break; if (man) man_reset(man); - if (mdoc) - mdoc_reset(mdoc); + if (mdoc && ! mdoc_reset(mdoc)) { + warnx("memory exhausted"); + break; + } argv++; } rc = NULL == *argv; @@ -273,8 +277,7 @@ version(void) { (void)printf("%s %s\n", __progname, VERSION); - exit(0); - /* NOTREACHED */ + exit(EXIT_SUCCESS); } @@ -285,8 +288,7 @@ usage(void) (void)fprintf(stderr, "usage: %s [-V] [-foption...] " "[-mformat] [-Toutput] [-Werr...]\n", __progname); - exit(1); - /* NOTREACHED */ + exit(EXIT_FAILURE); } |