summaryrefslogtreecommitdiffstats
path: root/cmd-list-keys.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-18 10:18:25 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-18 10:18:25 +0000
commit68f5c9c72da0c4430733de2094fbb8bc4d1e0474 (patch)
treeffd1dfd0e4f8a4ea3e8bd5a72520c126f5e5b6df /cmd-list-keys.c
parenta9ca8df8e3c477560dc6455cd4c73e582b89aef5 (diff)
Mark -n keys with (no prefix) rather than [].
Diffstat (limited to 'cmd-list-keys.c')
-rw-r--r--cmd-list-keys.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index b61951f9..13785fac 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -71,13 +71,15 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
key = key_string_lookup_key(bd->key & ~KEYC_PREFIX);
if (key == NULL)
continue;
- if (!(bd->key & KEYC_PREFIX))
- used = xsnprintf(tmp, sizeof tmp, "[%s]: ", key);
- else
- used = xsnprintf(tmp, sizeof tmp, "%*s: ", width, key);
+ used = xsnprintf(tmp, sizeof tmp, "%*s: ", width, key);
if (used >= sizeof tmp)
continue;
+ if (!(bd->key & KEYC_PREFIX)) {
+ used = strlcat(tmp, "(no prefix) ", sizeof tmp);
+ if (used >= sizeof tmp)
+ continue;
+ }
cmd_list_print(bd->cmdlist, tmp + used, (sizeof tmp) - used);
ctx->print(ctx, "%s", tmp);
}