diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-07 06:28:08 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-07 06:28:08 +0000 |
commit | f94c59bbe7eb707afda950ba464d3d0c2b94be7d (patch) | |
tree | 1635b53c0fd4bb792aa61cf289cd9efaf4e95e13 /demandoc.c | |
parent | 1e390373a2e27a0047fae8db8c21d17e044c8376 (diff) | |
download | mandoc-f94c59bbe7eb707afda950ba464d3d0c2b94be7d.tar.gz |
be more careful about argc == 0
Diffstat (limited to 'demandoc.c')
-rw-r--r-- | demandoc.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -47,8 +47,9 @@ main(int argc, char *argv[]) int ch, fd, i, list; extern int optind; - progname = strrchr(argv[0], '/'); - if (progname == NULL) + if (argc < 1) + progname = "demandoc"; + else if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; else ++progname; @@ -81,7 +82,7 @@ main(int argc, char *argv[]) mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_BADARG, NULL, mchars, NULL); assert(mp); - if (0 == argc) + if (argc < 1) pmandoc(mp, STDIN_FILENO, "<stdin>", list); for (i = 0; i < argc; i++) { |