diff options
| author | Ton Voon <ton.voon@opsera.com> | 2010-06-22 11:47:54 +0100 |
|---|---|---|
| committer | Ton Voon <ton.voon@opsera.com> | 2010-06-22 11:47:54 +0100 |
| commit | 9ff89b1a99926ebfeaeba7f415ae74f93eaef0a5 (patch) | |
| tree | 19387dc5aa14bf563f7e599b355cc1fb33c947f2 /lib/utils_base.c | |
| parent | 10364a6004616c2e52852d80b1e1817056aa7119 (diff) | |
| download | monitoring-plugins-9ff89b1a99926ebfeaeba7f415ae74f93eaef0a5.tar.gz | |
Added np_set_args, to set arguments after np_extra_opts has been run
Diffstat (limited to 'lib/utils_base.c')
| -rw-r--r-- | lib/utils_base.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c index 4e8d2ef7..6de92cbd 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c | |||
| @@ -48,11 +48,22 @@ void np_init( char *plugin_name, int argc, char **argv ) { | |||
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | void np_set_args( int argc, char **argv ) { | ||
| 52 | if (this_nagios_plugin==NULL) | ||
| 53 | die(STATE_UNKNOWN, _("This requires np_init to be called")); | ||
| 54 | |||
| 55 | this_nagios_plugin->argc = argc; | ||
| 56 | this_nagios_plugin->argv = argv; | ||
| 57 | } | ||
| 58 | |||
| 59 | |||
| 51 | void np_cleanup() { | 60 | void np_cleanup() { |
| 52 | if (this_nagios_plugin!=NULL) { | 61 | if (this_nagios_plugin!=NULL) { |
| 53 | if(this_nagios_plugin->state!=NULL) { | 62 | if(this_nagios_plugin->state!=NULL) { |
| 54 | np_free(this_nagios_plugin->state->state_data->data); | 63 | if(this_nagios_plugin->state->state_data) { |
| 55 | np_free(this_nagios_plugin->state->state_data); | 64 | np_free(this_nagios_plugin->state->state_data->data); |
| 65 | np_free(this_nagios_plugin->state->state_data); | ||
| 66 | } | ||
| 56 | np_free(this_nagios_plugin->state->name); | 67 | np_free(this_nagios_plugin->state->name); |
| 57 | np_free(this_nagios_plugin->state); | 68 | np_free(this_nagios_plugin->state); |
| 58 | } | 69 | } |
