summaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-31 13:50:19 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-31 13:50:19 +0000
commit4cd2606cca8b6f78a9d90bec6f4fa0c45c2dcd0f (patch)
tree428f5d4c3b3e002a94712ec6afcebb59424910b9 /main.c
parent3a15d29d3fd3d564da6a32a0ac9b49872b7d523c (diff)
downloadmandoc-4cd2606cca8b6f78a9d90bec6f4fa0c45c2dcd0f.tar.gz
mandoc-4cd2606cca8b6f78a9d90bec6f4fa0c45c2dcd0f.tar.zst
mandoc-4cd2606cca8b6f78a9d90bec6f4fa0c45c2dcd0f.zip
General clean-ups.
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/main.c b/main.c
index 046c2a55..53f1da14 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.17 2009/03/26 16:23:22 kristaps Exp $ */
+/* $Id: main.c,v 1.18 2009/03/31 13:50:19 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -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);
}