Yang Enumeration including space did not generate working CLIgen code, see [Choice with space is not working in CLIgen code](https://github.com/olofhagsand/cligen/issues/24)

This commit is contained in:
Olof hagsand 2019-05-15 11:12:23 +02:00
parent f8850990d4
commit 6f294fe67a
4 changed files with 23 additions and 13 deletions

View file

@ -311,7 +311,9 @@ yang2cli_var_sub(clicon_handle h,
char *type;
yang_stmt *yi = NULL;
int i = 0;
int j;
char *cvtypestr;
char *arg;
if (cvtype == CGV_VOID){
retval = 0;
@ -334,7 +336,13 @@ yang2cli_var_sub(clicon_handle h,
continue;
if (i)
cprintf(cb, "|");
cprintf(cb, "%s", yang_argument_get(yi));
/* Encode by escaping delimiters */
arg = yang_argument_get(yi);
for (j=0; j<strlen(arg); j++){
if (index(CLIGEN_DELIMITERS, arg[j]))
cprintf(cb, "\\");
cprintf(cb, "%c", arg[j]);
}
i++;
}
}