diff options
author | Ton Voon <ton.voon@opsera.com> | 2010-06-17 10:57:59 +0100 |
---|---|---|
committer | Ton Voon <ton.voon@opsera.com> | 2010-06-17 10:57:59 +0100 |
commit | 301599a4eca67e214ef79bd609843a9e1e710b3a (patch) | |
tree | e2404d11826e25e632d31dd4c6beea627e4dda9d /lib/utils_base.c | |
parent | 95b190f3dee629b1c1ee2fab5b69c08e511f51b3 (diff) | |
download | monitoring-plugins-301599a4eca67e214ef79bd609843a9e1e710b3a.tar.gz |
Add skeleton tests
Diffstat (limited to 'lib/utils_base.c')
-rw-r--r-- | lib/utils_base.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c index c9f0912a..fb442400 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <stdarg.h> | 28 | #include <stdarg.h> |
29 | #include "utils_base.h" | 29 | #include "utils_base.h" |
30 | 30 | ||
31 | #define np_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } } | ||
32 | |||
31 | void | 33 | void |
32 | die (int result, const char *fmt, ...) | 34 | die (int result, const char *fmt, ...) |
33 | { | 35 | { |
@@ -315,7 +317,7 @@ char *np_extract_value(const char *varlist, const char *name, char sep) { | |||
315 | * hopefully a unique key per service/plugin invocation. Use the extra-opts | 317 | * hopefully a unique key per service/plugin invocation. Use the extra-opts |
316 | * parse of argv, so that uniqueness in parameters are reflected there. | 318 | * parse of argv, so that uniqueness in parameters are reflected there. |
317 | */ | 319 | */ |
318 | char *np_state_generate_key(const char **argv) { | 320 | char *np_state_generate_key(char **argv) { |
319 | return "Ahash"; | 321 | return "Ahash"; |
320 | } | 322 | } |
321 | 323 | ||
@@ -352,6 +354,9 @@ state_key *np_state_init(char *plugin_name, char *keyname, int expected_data_ver | |||
352 | state_data *np_state_read(state_key *my_state_key) { | 354 | state_data *np_state_read(state_key *my_state_key) { |
353 | state_data *this_state_data=NULL; | 355 | state_data *this_state_data=NULL; |
354 | my_state_key->state_data = this_state_data; | 356 | my_state_key->state_data = this_state_data; |
357 | |||
358 | /* Open file */ | ||
359 | |||
355 | return this_state_data; | 360 | return this_state_data; |
356 | } | 361 | } |
357 | 362 | ||
@@ -362,12 +367,14 @@ state_data *np_state_read(state_key *my_state_key) { | |||
362 | * two things writing to same key at same time. | 367 | * two things writing to same key at same time. |
363 | * Will die with UNKNOWN if errors | 368 | * Will die with UNKNOWN if errors |
364 | */ | 369 | */ |
365 | void np_state_write_string(state_key *my_state_key, time_t data_time, char *data_string) { | 370 | void np_state_write_string(state_key *my_state_key, time_t *data_time, char *data_string) { |
366 | } | 371 | } |
367 | 372 | ||
368 | /* | 373 | /* |
369 | * Cleanup | 374 | * Cleanup |
370 | */ | 375 | */ |
371 | void np_state_cleanup(state_key *my_state_key) { | 376 | void np_state_cleanup(state_key *my_state_key) { |
377 | free(my_state_key); | ||
378 | my_state_key=NULL; | ||
372 | } | 379 | } |
373 | 380 | ||