summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/common/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/host/layer23/src/common/main.c')
-rw-r--r--src/host/layer23/src/common/main.c12
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)