aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_real.c
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-08-09 06:01:03 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-08-09 06:01:03 +0000
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 ecdd5619..9c9c3e0b 100644
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -38,10 +38,10 @@ void print_help (void);
void print_usage (void);
int server_port = PORT;
-char *server_address = "";
-char *host_name = "";
+char *server_address;
+char *host_name;
char *server_url = NULL;
-char *server_expect = EXPECT;
+char *server_expect;
int warning_time = 0;
int check_warning_time = FALSE;
int critical_time = 0;
@@ -294,18 +294,18 @@ process_arguments (int argc, char **argv)
switch (c) {
case 'I': /* hostname */
case 'H': /* hostname */
- if (is_host (optarg)) {
- server_address = optarg;
- }
- else {
+ if (server_address)
+ break;
+ else if (is_host (optarg))
+ server_address = strdup(optarg);
+ else
usage (_("Invalid host name\n"));
- }
break;
case 'e': /* string to expect in response header */
- server_expect = optarg;
+ server_expect = strdup(optarg);
break;
case 'u': /* server URL */
- server_url = optarg;
+ server_url = strdup(optarg);
break;
case 'p': /* port */
if (is_intpos (optarg)) {
@@ -356,7 +356,7 @@ process_arguments (int argc, char **argv)
}
c = optind;
- if (strlen(server_address)==0 && argc>c) {
+ if (server_address==NULL && argc>c) {
if (is_host (argv[c])) {
server_address = argv[c++];
}
@@ -365,11 +365,14 @@ process_arguments (int argc, char **argv)
}
}
- if (strlen(server_address) == 0)
+ if (server_address==NULL)
usage (_("You must provide a server to check\n"));
- if (strlen(host_name) == 0)
- asprintf (&host_name, "%s", server_address);
+ if (host_name==NULL)
+ host_name = strdup (server_address);
+
+ if (server_expect == NULL)
+ server_expect = strdup(EXPECT);
return validate_arguments ();
}