moved config yang spec from main functions to options_main function

This commit is contained in:
Olof hagsand 2019-12-01 17:42:34 +01:00
parent c4954f5c43
commit 08b128f4d7
6 changed files with 18 additions and 36 deletions

View file

@ -446,7 +446,6 @@ main(int argc,
char *nacm_mode;
int logdst = CLICON_LOG_SYSLOG|CLICON_LOG_STDERR;
yang_stmt *yspec = NULL;
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
char *str;
int ss = -1; /* server socket */
cbuf *cbret = NULL; /* startup cbuf if invalid */
@ -509,18 +508,12 @@ main(int argc,
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
clicon_debug_init(debug, NULL);
/* Create configure yang-spec (note different from dbspec holding application specs) */
if ((yspecfg = yspec_new()) == NULL)
goto done;
/* Find and read configfile */
if (clicon_options_main(h, yspecfg) < 0){
if (clicon_options_main(h) < 0){
if (help)
usage(h, argv[0]);
return -1;
}
if (clicon_config_yang_set(h, yspecfg) < 0)
goto done;
/* External NACM file? */
nacm_mode = clicon_option_str(h, "CLICON_NACM_MODE");

View file

@ -283,7 +283,6 @@ main(int argc, char **argv)
int logdst = CLICON_LOG_STDERR;
char *restarg = NULL; /* what remains after options */
yang_stmt *yspec;
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
struct passwd *pw;
char *str;
int tabmode;
@ -352,17 +351,12 @@ main(int argc, char **argv)
clicon_debug_init(debug, NULL);
/* Create configure yang-spec (note different from dbspec holding application specs) */
if ((yspecfg = yspec_new()) == NULL)
goto done;
/* Find and read configfile */
if (clicon_options_main(h, yspecfg) < 0){
/* Find, read and parse configfile */
if (clicon_options_main(h) < 0){
if (help)
usage(h, argv[0]);
return -1;
}
if (clicon_config_yang_set(h, yspecfg) < 0)
goto done;
/* Now rest of options */
opterr = 0;

View file

@ -395,7 +395,6 @@ main(int argc,
struct passwd *pw;
struct timeval tv = {0,}; /* timeout */
yang_stmt *yspec = NULL;
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
char *str;
uint32_t id;
cvec *nsctx_global = NULL; /* Global namespace context */
@ -443,15 +442,10 @@ main(int argc,
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
clicon_debug_init(debug, NULL);
/* Create configure yang-spec (note different from dbspec holding application specs) */
if ((yspecfg = yspec_new()) == NULL)
goto done;
/* Find and read configfile */
if (clicon_options_main(h, yspecfg) < 0)
/* Find, read and parse configfile */
if (clicon_options_main(h) < 0)
return -1;
if (clicon_config_yang_set(h, yspecfg) < 0)
goto done;
/* Now rest of options */
optind = 1;
opterr = 0;

View file

@ -582,7 +582,6 @@ main(int argc,
char *dir;
int logdst = CLICON_LOG_SYSLOG;
yang_stmt *yspec = NULL;
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
char *stream_path;
int finish = 0;
int start = 1;
@ -642,13 +641,8 @@ main(int argc,
goto done;
}
/* Create configure yang-spec note different from dbspec holding application specs) */
if ((yspecfg = yspec_new()) == NULL)
goto done;
/* Find and read configfile */
if (clicon_options_main(h, yspecfg) < 0)
goto done;
if (clicon_config_yang_set(h, yspecfg) < 0)
if (clicon_options_main(h) < 0)
goto done;
stream_path = clicon_option_str(h, "CLICON_STREAM_PATH");