=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-set-option.c,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** src/usr.bin/tmux/cmd-set-option.c 2009/07/13 23:11:35 1.5 --- src/usr.bin/tmux/cmd-set-option.c 2009/07/15 07:50:34 1.6 *************** *** 1,4 **** ! /* $OpenBSD: cmd-set-option.c,v 1.5 2009/07/13 23:11:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-set-option.c,v 1.6 2009/07/15 07:50:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 48,54 **** const char *set_option_bell_action_list[] = { "none", "any", "current", NULL }; ! const struct set_option_entry set_option_table[NSETOPTION] = { { "bell-action", SET_OPTION_CHOICE, 0, 0, set_option_bell_action_list }, { "buffer-limit", SET_OPTION_NUMBER, 1, INT_MAX, NULL }, { "default-command", SET_OPTION_STRING, 0, 0, NULL }, --- 48,54 ---- const char *set_option_bell_action_list[] = { "none", "any", "current", NULL }; ! const struct set_option_entry set_option_table[] = { { "bell-action", SET_OPTION_CHOICE, 0, 0, set_option_bell_action_list }, { "buffer-limit", SET_OPTION_NUMBER, 1, INT_MAX, NULL }, { "default-command", SET_OPTION_STRING, 0, 0, NULL }, *************** *** 75,80 **** --- 75,81 ---- { "status-right", SET_OPTION_STRING, 0, 0, NULL }, { "status-right-length", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL }, { "status-utf8", SET_OPTION_FLAG, 0, 0, NULL }, + { NULL, 0, 0, 0, NULL } }; int *************** *** 84,90 **** struct session *s; struct client *c; struct options *oo; ! const struct set_option_entry *entry; u_int i; if (data->chflags & CMD_CHFLAG('g')) --- 85,91 ---- struct session *s; struct client *c; struct options *oo; ! const struct set_option_entry *entry, *opt; u_int i; if (data->chflags & CMD_CHFLAG('g')) *************** *** 101,115 **** } entry = NULL; ! for (i = 0; i < NSETOPTION; i++) { ! if (strncmp(set_option_table[i].name, ! data->option, strlen(data->option)) != 0) continue; if (entry != NULL) { ctx->error(ctx, "ambiguous option: %s", data->option); return (-1); } ! entry = &set_option_table[i]; /* Bail now if an exact match. */ if (strcmp(entry->name, data->option) == 0) --- 102,115 ---- } entry = NULL; ! for (opt = set_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)