diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2012-02-25 12:57:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2012-02-25 12:57:42 +0000 |
commit | 4e7de210e4e260b6e29e2cde59d4d879faea5fa5 (patch) | |
tree | 116fe90d9c30e9e3c686b5c458dd505ffe162a64 /options-table.c | |
parent | aaf0bfccf45b2c2a606ef104b620939a5abcbddc (diff) | |
download | rtmux-4e7de210e4e260b6e29e2cde59d4d879faea5fa5.tar.gz rtmux-4e7de210e4e260b6e29e2cde59d4d879faea5fa5.tar.bz2 rtmux-4e7de210e4e260b6e29e2cde59d4d879faea5fa5.zip |
Allow a single option to be specified to show-options to show just that
option.
Diffstat (limited to 'options-table.c')
-rw-r--r-- | options-table.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/options-table.c b/options-table.c index b68e0b43..dfb8650a 100644 --- a/options-table.c +++ b/options-table.c @@ -569,6 +569,13 @@ const struct options_table_entry window_options_table[] = { .default_num = 0 }, + { .name = "rate-limit", + .type = OPTIONS_TABLE_NUMBER, + .minimum = 0, + .maximum = UINT_MAX, + .default_num = 0 + }, + { .name = "remain-on-exit", .type = OPTIONS_TABLE_FLAG, .default_num = 0 @@ -732,3 +739,36 @@ options_table_print_entry( } return (out); } + +/* Find an option. */ +int +options_table_find( + const char *optstr, const struct options_table_entry **table, + const struct options_table_entry **oe) +{ + static const struct options_table_entry *tables[] = { + server_options_table, + window_options_table, + session_options_table + }; + const struct options_table_entry *oe_loop; + u_int i; + + for (i = 0; i < nitems(tables); i++) { + for (oe_loop = tables[i]; oe_loop->name != NULL; oe_loop++) { + if (strncmp(oe_loop->name, optstr, strlen(optstr)) != 0) + continue; + + /* If already found, ambiguous. */ + if (*oe != NULL) + return (-1); + *oe = oe_loop; + *table = tables[i]; + + /* Bail now if an exact match. */ + if (strcmp((*oe)->name, optstr) == 0) + break; + } + } + return (0); +} |