Fix printing commands with no arguments, from Benjamin Poirier.

This commit is contained in:
Nicholas Marriott 2012-04-22 05:24:05 +00:00
parent e8dff68588
commit 5cbca2e70f

7
cmd.c
View File

@ -304,11 +304,10 @@ cmd_print(struct cmd *cmd, char *buf, size_t len)
if (off < len) { if (off < len) {
used = args_print(cmd->args, buf + off, len - off); used = args_print(cmd->args, buf + off, len - off);
if (used == 0) if (used == 0)
buf[off - 1] = '\0'; off--;
else { else
off += used; off += used;
buf[off] = '\0'; buf[off] = '\0';
}
} }
return (off); return (off);
} }