summaryrefslogtreecommitdiffstatshomepage
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
commit0bb92cdf676a4f8a32b2066037b9f54b3f587f9e (patch)
tree152efafe36b7ca4f93c18f3c217d040821076b0b
parent1730c3f7be321f16ec6b7afdfd0fb10a265d23bc (diff)
downloadmandoc-0bb92cdf676a4f8a32b2066037b9f54b3f587f9e.tar.gz
mandoc-0bb92cdf676a4f8a32b2066037b9f54b3f587f9e.tar.zst
mandoc-0bb92cdf676a4f8a32b2066037b9f54b3f587f9e.zip
Made sure saved value is initialised.
-rw-r--r--argv.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/argv.c b/argv.c
index 4865cdf4..8c283029 100644
--- a/argv.c
+++ b/argv.c
@@ -1,4 +1,4 @@
-/* $Id: argv.c,v 1.46 2009/03/10 15:01:54 kristaps Exp $ */
+/* $Id: argv.c,v 1.47 2009/03/10 21:27:39 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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);