diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-12-27 14:51:13 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-12-27 19:01:37 +0100 |
commit | ace267cfc20cbd05a6aa953d1d05733b4d174dd6 (patch) | |
tree | 04702670f9e4ef3601ab1fcceba49c56763f1a31 /src/host/layer23/src/common/main.c | |
parent | 63c0e6d1996733d107434585fbef5e888b3075ed (diff) |
layer23: Enable combining the long options
Combine the long options from the base and the application. Provide
the long option for the cell log application.
Diffstat (limited to 'src/host/layer23/src/common/main.c')
-rw-r--r-- | src/host/layer23/src/common/main.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c index a791ccf4..cb9564a4 100644 --- a/src/host/layer23/src/common/main.c +++ b/src/host/layer23/src/common/main.c @@ -110,6 +110,9 @@ static void print_help() static void build_config(char **opt, struct option **option) { struct l23_app_info *app; + struct option *app_opp = NULL; + int app_len = 0, len; + static struct option long_options[] = { {"help", 0, 0, 'h'}, {"socket", 1, 0, 's'}, @@ -124,9 +127,14 @@ static void build_config(char **opt, struct option **option) app = l23_app_info(); *opt = talloc_asprintf(l23_ctx, "hs:S:a:i:v:d:%s", app && app->getopt_string ? app->getopt_string : ""); - *option = talloc_zero_array(l23_ctx, struct option, - ARRAY_SIZE(long_options) + 1); + + len = ARRAY_SIZE(long_options); + if (app && app->cfg_getopt_opt) + app_len = app->cfg_getopt_opt(&app_opp); + + *option = talloc_zero_array(l23_ctx, struct option, len + app_len + 1); memcpy(*option, long_options, sizeof(long_options)); + memcpy(*option + len, app_opp, app_len * sizeof(struct option)); } static void handle_options(int argc, char **argv) |