* Added cligen variable translation.

* See FAQ and example
This commit is contained in:
Olof hagsand 2018-05-28 22:50:22 +02:00
parent b230215eaf
commit cfe4702069
6 changed files with 65 additions and 1 deletions

View file

@ -137,3 +137,21 @@ clixon_plugin_init(clicon_handle h)
return &api;
}
/*! Translate function from an original value to a new.
* In this case, assume string and increment characters, eg HAL->IBM
*/
int
incstr(cligen_handle h,
cg_var *cv)
{
char *str;
int i;
if (cv_type_get(cv) != CGV_STRING)
return 0;
str = cv_string_get(cv);
for (i=0; i<strlen(str); i++)
str[i]++;
return 0;
}