summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-04-22 05:24:06 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-04-22 05:24:06 +0000
commit856ac2591baaf667bfcf163c7fbcb9f5a766137e (patch)
treebfbc93256b337eebf744b123f4a175fe82dde559 /usr.bin/tmux
parent505ddb64be21959e3aef2a7746b35191e4d061f2 (diff)
Fix printing commands with no arguments, from Benjamin Poirier.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/cmd.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 08744ed651e..5b9ba25de01 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.63 2012/03/03 08:31:18 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.64 2012/04/22 05:24:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -304,11 +304,10 @@ cmd_print(struct cmd *cmd, char *buf, size_t len)
if (off < len) {
used = args_print(cmd->args, buf + off, len - off);
if (used == 0)
- buf[off - 1] = '\0';
- else {
+ off--;
+ else
off += used;
- buf[off] = '\0';
- }
+ buf[off] = '\0';
}
return (off);
}