From ed64333f38850f0018d8c142347f2fb6cf35d5f8 Mon Sep 17 00:00:00 2001 From: david parsons Date: Sun, 22 Jan 2017 00:15:41 -0800 Subject: [PATCH] Make the horrible inline options parsing for mkd2html a teeny bit more robust by not bothering to look for options unless there are at least two arguments left in argv[] --- mkd2html.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkd2html.c b/mkd2html.c index a875aa9..626090f 100644 --- a/mkd2html.c +++ b/mkd2html.c @@ -81,7 +81,11 @@ char **argv; CREATE(footers); pgm = basename(argv[0]); - while ( argc > 1 ) { + /* the only options we have for this program are -name value pairs, + * so don't even bother parsing them if there aren't still a couple + * of arguments waiting on the line. + */ + while ( argc > 2 ) { if ( strcmp(argv[1], "-css") == 0 ) { EXPAND(css) = argv[2]; argc -= 2;