diff options
author | Tiago Cunha <tcunha@gmx.com> | 2012-03-03 09:16:52 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2012-03-03 09:16:52 +0000 |
commit | 95f427c34e4db9d7456d2d747e6cd6b54d8badcc (patch) | |
tree | ac12c6644586d639352118b7c1c583e33edc75ec /options-table.c | |
parent | e0d22218798d1218d88cb095d251df12d3ebbc35 (diff) | |
download | rtmux-95f427c34e4db9d7456d2d747e6cd6b54d8badcc.tar.gz rtmux-95f427c34e4db9d7456d2d747e6cd6b54d8badcc.tar.bz2 rtmux-95f427c34e4db9d7456d2d747e6cd6b54d8badcc.zip |
Sync OpenBSD patchset 1032:
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 | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/options-table.c b/options-table.c index 8f525161..57896fc5 100644 --- a/options-table.c +++ b/options-table.c @@ -731,3 +731,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); +} |