=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/arguments.c,v retrieving revision 1.26 retrieving revision 1.27 diff -c -r1.26 -r1.27 *** src/usr.bin/tmux/arguments.c 2019/06/20 07:10:56 1.26 --- src/usr.bin/tmux/arguments.c 2019/07/09 14:03:12 1.27 *************** *** 1,4 **** ! /* $OpenBSD: arguments.c,v 1.26 2019/06/20 07:10:56 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: arguments.c,v 1.27 2019/07/09 14:03:12 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott *************** *** 38,43 **** --- 38,44 ---- struct args_entry { u_char flag; struct args_values values; + u_int count; RB_ENTRY(args_entry) entry; }; *************** *** 174,179 **** --- 175,181 ---- size_t len; char *buf; int i; + u_int j; struct args_entry *entry; struct args_value *value; *************** *** 187,193 **** if (*buf == '\0') args_print_add(&buf, &len, "-"); ! args_print_add(&buf, &len, "%c", entry->flag); } /* Then the flags with arguments. */ --- 189,196 ---- if (*buf == '\0') args_print_add(&buf, &len, "-"); ! for (j = 0; j < entry->count; j++) ! args_print_add(&buf, &len, "%c", entry->flag); } /* Then the flags with arguments. */ *************** *** 244,250 **** int args_has(struct args *args, u_char ch) { ! return (args_find(args, ch) != NULL); } /* Set argument value in the arguments tree. */ --- 247,258 ---- int args_has(struct args *args, u_char ch) { ! struct args_entry *entry; ! ! entry = args_find(args, ch); ! if (entry == NULL) ! return (0); ! return (entry->count); } /* Set argument value in the arguments tree. */ *************** *** 258,266 **** if (entry == NULL) { entry = xcalloc(1, sizeof *entry); entry->flag = ch; TAILQ_INIT(&entry->values); RB_INSERT(args_tree, &args->tree, entry); ! } if (s != NULL) { value = xcalloc(1, sizeof *value); --- 266,276 ---- if (entry == NULL) { entry = xcalloc(1, sizeof *entry); entry->flag = ch; + entry->count = 1; TAILQ_INIT(&entry->values); RB_INSERT(args_tree, &args->tree, entry); ! } else ! entry->count++; if (s != NULL) { value = xcalloc(1, sizeof *value);