diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 06:01:03 (GMT) |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 06:01:03 (GMT) |
commit | a228492c4bea15a3e6e7bdbfd6631611c97fe92c (patch) | |
tree | 0d21d5c54a2ab5ec3f4171fab668d390ea09bbaa /plugins/check_real.c | |
parent | 024751bac56791b7ae5347404274046e8ba58ccb (diff) | |
download | monitoring-plugins-a228492c4bea15a3e6e7bdbfd6631611c97fe92c.tar.gz |
more pedantic compiler warns
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@672 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_real.c')
-rw-r--r-- | plugins/check_real.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/plugins/check_real.c b/plugins/check_real.c index ecdd561..9c9c3e0 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c | |||
@@ -38,10 +38,10 @@ void print_help (void); | |||
38 | void print_usage (void); | 38 | void print_usage (void); |
39 | 39 | ||
40 | int server_port = PORT; | 40 | int server_port = PORT; |
41 | char *server_address = ""; | 41 | char *server_address; |
42 | char *host_name = ""; | 42 | char *host_name; |
43 | char *server_url = NULL; | 43 | char *server_url = NULL; |
44 | char *server_expect = EXPECT; | 44 | char *server_expect; |
45 | int warning_time = 0; | 45 | int warning_time = 0; |
46 | int check_warning_time = FALSE; | 46 | int check_warning_time = FALSE; |
47 | int critical_time = 0; | 47 | int critical_time = 0; |
@@ -294,18 +294,18 @@ process_arguments (int argc, char **argv) | |||
294 | switch (c) { | 294 | switch (c) { |
295 | case 'I': /* hostname */ | 295 | case 'I': /* hostname */ |
296 | case 'H': /* hostname */ | 296 | case 'H': /* hostname */ |
297 | if (is_host (optarg)) { | 297 | if (server_address) |
298 | server_address = optarg; | 298 | break; |
299 | } | 299 | else if (is_host (optarg)) |
300 | else { | 300 | server_address = strdup(optarg); |
301 | else | ||
301 | usage (_("Invalid host name\n")); | 302 | usage (_("Invalid host name\n")); |
302 | } | ||
303 | break; | 303 | break; |
304 | case 'e': /* string to expect in response header */ | 304 | case 'e': /* string to expect in response header */ |
305 | server_expect = optarg; | 305 | server_expect = strdup(optarg); |
306 | break; | 306 | break; |
307 | case 'u': /* server URL */ | 307 | case 'u': /* server URL */ |
308 | server_url = optarg; | 308 | server_url = strdup(optarg); |
309 | break; | 309 | break; |
310 | case 'p': /* port */ | 310 | case 'p': /* port */ |
311 | if (is_intpos (optarg)) { | 311 | if (is_intpos (optarg)) { |
@@ -356,7 +356,7 @@ process_arguments (int argc, char **argv) | |||
356 | } | 356 | } |
357 | 357 | ||
358 | c = optind; | 358 | c = optind; |
359 | if (strlen(server_address)==0 && argc>c) { | 359 | if (server_address==NULL && argc>c) { |
360 | if (is_host (argv[c])) { | 360 | if (is_host (argv[c])) { |
361 | server_address = argv[c++]; | 361 | server_address = argv[c++]; |
362 | } | 362 | } |
@@ -365,11 +365,14 @@ process_arguments (int argc, char **argv) | |||
365 | } | 365 | } |
366 | } | 366 | } |
367 | 367 | ||
368 | if (strlen(server_address) == 0) | 368 | if (server_address==NULL) |
369 | usage (_("You must provide a server to check\n")); | 369 | usage (_("You must provide a server to check\n")); |
370 | 370 | ||
371 | if (strlen(host_name) == 0) | 371 | if (host_name==NULL) |
372 | asprintf (&host_name, "%s", server_address); | 372 | host_name = strdup (server_address); |
373 | |||
374 | if (server_expect == NULL) | ||
375 | server_expect = strdup(EXPECT); | ||
373 | 376 | ||
374 | return validate_arguments (); | 377 | return validate_arguments (); |
375 | } | 378 | } |