* clixon-config YAML file has new revision: 2019-02-06.
* Replaced all calls to (obsolete) `cli_output` with `fprintf` * Added _experimental_ config option `CLICON_CLI_UTF8` default set to 0. * CLIgen UTF8 does not work with scrolling and control editing
This commit is contained in:
parent
ae8d28fae8
commit
5b1c3d9a86
11 changed files with 55 additions and 28 deletions
|
|
@ -352,7 +352,7 @@ main(int argc, char **argv)
|
|||
break; /* see above */
|
||||
case 'F': /* read commands from file */
|
||||
if (freopen(optarg, "r", stdin) == NULL){
|
||||
cli_output(stderr, "freopen: %s\n", strerror(errno));
|
||||
fprintf(stderr, "freopen: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
|
@ -531,6 +531,7 @@ main(int argc, char **argv)
|
|||
*(argv-1) = tmp;
|
||||
|
||||
cligen_line_scrolling_set(cli_cligen(h), clicon_option_int(h,"CLICON_CLI_LINESCROLLING"));
|
||||
cligen_utf8_set(cli_cligen(h), clicon_option_int(h,"CLICON_CLI_UTF8"));
|
||||
/* Launch interfactive event loop, unless -1 */
|
||||
if (restarg != NULL && strlen(restarg)){
|
||||
char *mode = cli_syntax_mode(h);
|
||||
|
|
|
|||
|
|
@ -455,15 +455,13 @@ int
|
|||
cli_handler_err(FILE *f)
|
||||
{
|
||||
if (clicon_errno){
|
||||
cli_output(f, "%s: %s",
|
||||
clicon_strerror(clicon_errno),
|
||||
clicon_err_reason);
|
||||
fprintf(f, "%s: %s", clicon_strerror(clicon_errno), clicon_err_reason);
|
||||
if (clicon_suberrno)
|
||||
cli_output(f, ": %s", strerror(clicon_suberrno));
|
||||
cli_output(f, "\n");
|
||||
fprintf(f, ": %s", strerror(clicon_suberrno));
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
else
|
||||
cli_output(f, "CLI command error\n");
|
||||
fprintf(f, "CLI command error\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -482,7 +480,6 @@ clicon_eval(clicon_handle h,
|
|||
{
|
||||
int retval = 0;
|
||||
|
||||
cli_output_reset();
|
||||
if (!cligen_exiting(cli_cligen(h))) {
|
||||
clicon_err_reset();
|
||||
if ((retval = cligen_eval(cli_cligen(h), match_obj, cvv)) < 0) {
|
||||
|
|
@ -546,7 +543,7 @@ clicon_parse(clicon_handle h,
|
|||
}
|
||||
else {
|
||||
if ((smode = syntax_mode_find(stx, modename, 0)) == NULL) {
|
||||
cli_output(f, "Can't find syntax mode '%s'\n", modename);
|
||||
fprintf(f, "Can't find syntax mode '%s'\n", modename);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
|
@ -576,13 +573,12 @@ clicon_parse(clicon_handle h,
|
|||
switch (retval) {
|
||||
case CG_EOF: /* eof */
|
||||
case CG_ERROR:
|
||||
cli_output(f, "CLI parse error: %s\n", cmd);
|
||||
fprintf(f, "CLI parse error: %s\n", cmd);
|
||||
break;
|
||||
case CG_NOMATCH: /* no match */
|
||||
/* clicon_err(OE_CFG, 0, "CLI syntax error: \"%s\": %s",
|
||||
cmd, cli_nomatch(h));*/
|
||||
cli_output(f, "CLI syntax error: \"%s\": %s\n",
|
||||
cmd, cli_nomatch(h));
|
||||
fprintf(f, "CLI syntax error: \"%s\": %s\n", cmd, cli_nomatch(h));
|
||||
break;
|
||||
case CG_MATCH:
|
||||
if (strcmp(modename, *modenamep)){ /* Command in different mode */
|
||||
|
|
@ -596,7 +592,7 @@ clicon_parse(clicon_handle h,
|
|||
*evalres = r;
|
||||
break;
|
||||
default:
|
||||
cli_output(f, "CLI syntax error: \"%s\" is ambiguous\n", cmd);
|
||||
fprintf(f, "CLI syntax error: \"%s\" is ambiguous\n", cmd);
|
||||
break;
|
||||
} /* switch retval */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ expand_dbvar(void *h,
|
|||
if (xml_merge(xt, xtop, yspec, &reason) < 0) /* Merge xtop into xt */
|
||||
goto done;
|
||||
if (reason){
|
||||
cli_output(stderr, "%s\n", reason);
|
||||
fprintf(stderr, "%s\n", reason);
|
||||
goto done;
|
||||
}
|
||||
if ((xcur = xpath_first(xt, "%s", xpath)) == NULL){
|
||||
|
|
@ -602,9 +602,11 @@ done:
|
|||
return retval;
|
||||
}
|
||||
|
||||
int cli_show_version(clicon_handle h, cvec *vars, cvec *argv)
|
||||
int cli_show_version(clicon_handle h,
|
||||
cvec *vars,
|
||||
cvec *argv)
|
||||
{
|
||||
cli_output(stdout, "%s\n", CLIXON_VERSION_STRING);
|
||||
fprintf(stdout, "%s\n", CLIXON_VERSION_STRING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ int cli_notification_register(clicon_handle h, char *stream, enum format_enum fo
|
|||
char *filter, int status,
|
||||
int (*fn)(int, void*), void *arg);
|
||||
|
||||
#define cli_output cligen_output
|
||||
/* cli_common.c: CLIgen new vector callbacks */
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue