summaryrefslogtreecommitdiffstats
path: root/plugins/check_real.c
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-09 06:01:03 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-09 06:01:03 (GMT)
commita228492c4bea15a3e6e7bdbfd6631611c97fe92c (patch)
tree0d21d5c54a2ab5ec3f4171fab668d390ea09bbaa /plugins/check_real.c
parent024751bac56791b7ae5347404274046e8ba58ccb (diff)
downloadmonitoring-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.c31
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);
38void print_usage (void); 38void print_usage (void);
39 39
40int server_port = PORT; 40int server_port = PORT;
41char *server_address = ""; 41char *server_address;
42char *host_name = ""; 42char *host_name;
43char *server_url = NULL; 43char *server_url = NULL;
44char *server_expect = EXPECT; 44char *server_expect;
45int warning_time = 0; 45int warning_time = 0;
46int check_warning_time = FALSE; 46int check_warning_time = FALSE;
47int critical_time = 0; 47int 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}