Changed plugin_init() backend return semantics: If returns NULL, _without_ calling clicon_err(), the module is disabled.

Also, example documentation corrected according to:
https://github.com/clicon/clixon/issues/33
This commit is contained in:
Olof hagsand 2018-07-13 12:44:59 +02:00
parent 60ce7b12bd
commit ee946a00f5
7 changed files with 52 additions and 17 deletions

View file

@ -23,7 +23,7 @@ routing example. It contains the following files:
```
Start backend:
```
clixon_backend -f /usr/local/etc/example.xml -I
sudo clixon_backend -f /usr/local/etc/example.xml -s init
```
Edit cli:
```

View file

@ -114,6 +114,13 @@ static clixon_plugin_api api = {
clixon_plugin_api *
clixon_plugin_init(clicon_handle h)
{
char *nacm_mode;
clicon_debug(1, "%s backend nacm", __FUNCTION__);
nacm_mode = clicon_option_str(h, "CLICON_NACM_MODE");
if (nacm_mode==NULL || strcmp(nacm_mode, "disabled") == 0){
clicon_debug(1, "%s CLICON_NACM_MODE not enabled: example nacm module disabled", __FUNCTION__);
return NULL;
}
return &api;
}