=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-set-option.c,v retrieving revision 1.103 retrieving revision 1.104 diff -c -r1.103 -r1.104 *** src/usr.bin/tmux/cmd-set-option.c 2017/01/11 14:56:44 1.103 --- src/usr.bin/tmux/cmd-set-option.c 2017/01/12 15:36:35 1.104 *************** *** 1,4 **** ! /* $OpenBSD: cmd-set-option.c,v 1.103 2017/01/11 14:56:44 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-set-option.c,v 1.104 2017/01/12 15:36:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 292,301 **** cmdq_error(item, "empty value"); return (CMD_RETURN_ERROR); } ! if (o != NULL && args_has(args, 'a')) ! options_set_string(oo, optstr, "%s%s", o->str, valstr); ! else ! options_set_string(oo, optstr, "%s", valstr); } return (CMD_RETURN_NORMAL); } --- 292,299 ---- cmdq_error(item, "empty value"); return (CMD_RETURN_ERROR); } ! options_set_string(oo, optstr, args_has(args, 'a'), "%s", ! valstr); } return (CMD_RETURN_NORMAL); } *************** *** 316,325 **** if (args_has(args, 'g') || oo == global_options) { switch (oe->type) { case OPTIONS_TABLE_STRING: ! options_set_string(oo, oe->name, "%s", oe->default_str); break; case OPTIONS_TABLE_STYLE: ! options_set_style(oo, oe->name, oe->default_str, 0); break; default: options_set_number(oo, oe->name, oe->default_num); --- 314,324 ---- if (args_has(args, 'g') || oo == global_options) { switch (oe->type) { case OPTIONS_TABLE_STRING: ! options_set_string(oo, oe->name, 0, "%s", ! oe->default_str); break; case OPTIONS_TABLE_STYLE: ! options_set_style(oo, oe->name, 0, oe->default_str); break; default: options_set_number(oo, oe->name, oe->default_num); *************** *** 391,410 **** const struct options_table_entry *oe, struct options *oo, const char *value) { ! struct args *args = self->args; ! struct options_entry *o; ! char *oldval, *newval; ! if (args_has(args, 'a')) { ! oldval = options_get_string(oo, oe->name); ! xasprintf(&newval, "%s%s", oldval, value); ! } else ! newval = xstrdup(value); ! ! o = options_set_string(oo, oe->name, "%s", newval); ! ! free(newval); ! return (o); } /* Set a number option. */ --- 390,399 ---- const struct options_table_entry *oe, struct options *oo, const char *value) { ! struct args *args = self->args; ! int append = args_has(args, 'a'); ! return (options_set_string(oo, oe->name, append, "%s", value)); } /* Set a number option. */ *************** *** 544,554 **** const char *value) { struct args *args = self->args; struct options_entry *o; - int append; ! append = args_has(args, 'a'); ! if ((o = options_set_style(oo, oe->name, value, append)) == NULL) { cmdq_error(item, "bad style: %s", value); return (NULL); } --- 533,542 ---- const char *value) { struct args *args = self->args; + int append = args_has(args, 'a'); struct options_entry *o; ! if ((o = options_set_style(oo, oe->name, append, value)) == NULL) { cmdq_error(item, "bad style: %s", value); return (NULL); }