=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/Attic/cmd-set-window-option.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/tmux/Attic/cmd-set-window-option.c 2009/08/04 18:45:57 1.10 --- src/usr.bin/tmux/Attic/cmd-set-window-option.c 2009/08/11 12:53:37 1.11 *************** *** 1,4 **** ! /* $OpenBSD: cmd-set-window-option.c,v 1.10 2009/08/04 18:45:57 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-set-window-option.c,v 1.11 2009/08/11 12:53:37 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 31,43 **** const struct cmd_entry cmd_set_window_option_entry = { "set-window-option", "setw", ! "[-agu] " CMD_OPTION_WINDOW_USAGE, ! 0, CMD_CHFLAG('a')|CMD_CHFLAG('g')|CMD_CHFLAG('u'), NULL, ! cmd_option_parse, cmd_set_window_option_exec, ! cmd_option_free, ! cmd_option_print }; const char *set_option_mode_keys_list[] = { --- 31,43 ---- const struct cmd_entry cmd_set_window_option_entry = { "set-window-option", "setw", ! "[-agu] " CMD_TARGET_WINDOW_USAGE " option [value]", ! CMD_ARG12, CMD_CHFLAG('a')|CMD_CHFLAG('g')|CMD_CHFLAG('u'), NULL, ! cmd_target_parse, cmd_set_window_option_exec, ! cmd_target_free, ! cmd_target_print }; const char *set_option_mode_keys_list[] = { *************** *** 78,84 **** int cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx) { ! struct cmd_option_data *data = self->data; struct winlink *wl; struct client *c; struct options *oo; --- 78,84 ---- int cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx) { ! struct cmd_target_data *data = self->data; struct winlink *wl; struct client *c; struct options *oo; *************** *** 93,119 **** oo = &wl->window->options; } ! if (*data->option == '\0') { ctx->error(ctx, "invalid option"); return (-1); } entry = NULL; for (opt = set_window_option_table; opt->name != NULL; opt++) { ! if (strncmp(opt->name, data->option, strlen(data->option)) != 0) continue; if (entry != NULL) { ! ctx->error(ctx, "ambiguous option: %s", data->option); return (-1); } entry = opt; /* Bail now if an exact match. */ ! if (strcmp(entry->name, data->option) == 0) break; } if (entry == NULL) { ! ctx->error(ctx, "unknown option: %s", data->option); return (-1); } --- 93,119 ---- oo = &wl->window->options; } ! if (*data->arg == '\0') { ctx->error(ctx, "invalid option"); return (-1); } entry = NULL; for (opt = set_window_option_table; opt->name != NULL; opt++) { ! if (strncmp(opt->name, data->arg, strlen(data->arg)) != 0) continue; if (entry != NULL) { ! ctx->error(ctx, "ambiguous option: %s", data->arg); return (-1); } entry = opt; /* Bail now if an exact match. */ ! if (strcmp(entry->name, data->arg) == 0) break; } if (entry == NULL) { ! ctx->error(ctx, "unknown option: %s", data->arg); return (-1); } *************** *** 123,129 **** "can't unset global option: %s", entry->name); return (-1); } ! if (data->value != NULL) { ctx->error(ctx, "value passed to unset option: %s", entry->name); return (-1); --- 123,129 ---- "can't unset global option: %s", entry->name); return (-1); } ! if (data->arg2 != NULL) { ctx->error(ctx, "value passed to unset option: %s", entry->name); return (-1); *************** *** 135,159 **** switch (entry->type) { case SET_OPTION_STRING: set_option_string(ctx, oo, entry, ! data->value, data->chflags & CMD_CHFLAG('a')); break; case SET_OPTION_NUMBER: ! set_option_number(ctx, oo, entry, data->value); break; case SET_OPTION_KEY: ! set_option_key(ctx, oo, entry, data->value); break; case SET_OPTION_COLOUR: ! set_option_colour(ctx, oo, entry, data->value); break; case SET_OPTION_ATTRIBUTES: ! set_option_attributes(ctx, oo, entry, data->value); break; case SET_OPTION_FLAG: ! set_option_flag(ctx, oo, entry, data->value); break; case SET_OPTION_CHOICE: ! set_option_choice(ctx, oo, entry, data->value); break; } } --- 135,159 ---- switch (entry->type) { case SET_OPTION_STRING: set_option_string(ctx, oo, entry, ! data->arg2, data->chflags & CMD_CHFLAG('a')); break; case SET_OPTION_NUMBER: ! set_option_number(ctx, oo, entry, data->arg2); break; case SET_OPTION_KEY: ! set_option_key(ctx, oo, entry, data->arg2); break; case SET_OPTION_COLOUR: ! set_option_colour(ctx, oo, entry, data->arg2); break; case SET_OPTION_ATTRIBUTES: ! set_option_attributes(ctx, oo, entry, data->arg2); break; case SET_OPTION_FLAG: ! set_option_flag(ctx, oo, entry, data->arg2); break; case SET_OPTION_CHOICE: ! set_option_choice(ctx, oo, entry, data->arg2); break; } }