diff options
| author | Ton Voon <ton.voon@opsera.com> | 2010-06-17 11:11:57 +0100 |
|---|---|---|
| committer | Ton Voon <ton.voon@opsera.com> | 2010-06-17 11:11:57 +0100 |
| commit | 17f96bc1455acaf3015e337f99aaac7b58c55dbb (patch) | |
| tree | 7330b3044e346565339cbec004fc3a5c8e8982bc /lib/utils_base.c | |
| parent | 301599a4eca67e214ef79bd609843a9e1e710b3a (diff) | |
| download | monitoring-plugins-17f96bc1455acaf3015e337f99aaac7b58c55dbb.tar.gz | |
Added calculate location directory
Diffstat (limited to 'lib/utils_base.c')
| -rw-r--r-- | lib/utils_base.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c index fb442400..b717a99a 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c | |||
| @@ -321,6 +321,10 @@ char *np_state_generate_key(char **argv) { | |||
| 321 | return "Ahash"; | 321 | return "Ahash"; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | char* _np_state_calculate_location_prefix(){ | ||
| 325 | return NP_SHAREDSTATE_DIR; | ||
| 326 | } | ||
| 327 | |||
| 324 | /* | 328 | /* |
| 325 | * Initiatializer for state routines. | 329 | * Initiatializer for state routines. |
| 326 | * Sets variables. Generates filename. Returns np_state_key. die with | 330 | * Sets variables. Generates filename. Returns np_state_key. die with |
| @@ -328,6 +332,7 @@ char *np_state_generate_key(char **argv) { | |||
| 328 | */ | 332 | */ |
| 329 | state_key *np_state_init(char *plugin_name, char *keyname, int expected_data_version) { | 333 | state_key *np_state_init(char *plugin_name, char *keyname, int expected_data_version) { |
| 330 | state_key *this_state = NULL; | 334 | state_key *this_state = NULL; |
| 335 | char *temp_filename = NULL; | ||
| 331 | 336 | ||
| 332 | this_state = (state_key *) malloc(sizeof(state_key)); | 337 | this_state = (state_key *) malloc(sizeof(state_key)); |
| 333 | 338 | ||
| @@ -339,7 +344,8 @@ state_key *np_state_init(char *plugin_name, char *keyname, int expected_data_ver | |||
| 339 | this_state->data_version=expected_data_version; | 344 | this_state->data_version=expected_data_version; |
| 340 | 345 | ||
| 341 | /* Calculate filename */ | 346 | /* Calculate filename */ |
| 342 | this_state->_filename="Tobedone"; | 347 | asprintf(&temp_filename, "%s/%s", _np_state_calculate_location_prefix(), plugin_name); |
| 348 | this_state->_filename=temp_filename; | ||
| 343 | 349 | ||
| 344 | return this_state; | 350 | return this_state; |
| 345 | } | 351 | } |
