diff --git a/src/main.c b/src/main.c index 2d39e26f5a8d47871fa9666c148797427bd93a25..c3936b6514d51b12b2557ac722d3a247f3481bd4 100644 --- a/src/main.c +++ b/src/main.c @@ -73,6 +73,7 @@ static void timemngr_usage(char *n) "\nUsage: %s: <options>\n" "Options:\n" " -l <loglevel> log verbosity value as per standard syslog\n" + " -d <schema dm> Display the schema data model supported by micro-service\n" " -h help\n\n" , n); } @@ -80,13 +81,16 @@ static void timemngr_usage(char *n) int main(int argc, char **argv) { int log_level = 3; // Default is LOG_ERR - int c = 0; + int c = 0, dm_type = 0; - while ((c = getopt(argc, argv, "l:h")) != -1) { + while ((c = getopt(argc, argv, "dl:h")) != -1) { switch (c) { case 'h': timemngr_usage(argv[0]); return EXIT_SUCCESS; + case 'd': + dm_type++; + break; case 'l': if (optarg) { log_level = (int)strtod(optarg, NULL); @@ -107,6 +111,11 @@ int main(int argc, char **argv) bbfdm_ubus_set_log_level(log_level); bbfdm_ubus_load_data_model(tDynamicObj); + if (dm_type > 0) { + int res = bbfdm_print_data_model_schema(&bbfdm_ctx, dm_type); + exit(res); + } + openlog("timemngr", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); PRINT_DEBUG("Starting timemngr daemon");