summaryrefslogtreecommitdiffstats
path: root/argv.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-10 21:27:39 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-10 21:27:39 +0000
commit3a26b8088d5978b9e623c51df0dcaf7206eae3e4 (patch)
treeb99a9664b17c655d124639fab9378fb6b0f575a4 /argv.c
parentf3c9eab1da2779b6766d824dadb71d6cfb070509 (diff)
downloadmandoc-3a26b8088d5978b9e623c51df0dcaf7206eae3e4.tar.gz
Made sure saved value is initialised.
Diffstat (limited to 'argv.c')
-rw-r--r--argv.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/argv.c b/argv.c
index f90beffd..fd2a99e5 100644
--- a/argv.c
+++ b/argv.c
@@ -253,9 +253,11 @@ mdoc_argv(struct mdoc *mdoc, int line, int tok,
/*
* XXX: save the nullified byte as we'll restore it if this
- * doesn't end up being a command after all.
+ * doesn't end up being a command after all. This is a little
+ * bit hacky. I don't like it, but it works for now.
*/
+ sv = 0;
if (buf[*pos]) {
sv = buf[*pos];
buf[(*pos)++] = 0;
@@ -272,8 +274,9 @@ mdoc_argv(struct mdoc *mdoc, int line, int tok,
*/
if (MDOC_ARG_MAX == (tmp.arg = argv_a2arg(tok, p))) {
- /* Restore saved byte. */
- buf[*pos - 1] = sv;
+ /* XXX - restore saved byte. */
+ if (sv)
+ buf[*pos - 1] = sv;
if ( ! pwarn(mdoc, line, i, WARGVPARM))
return(ARGV_ERROR);
return(ARGV_WORD);