summaryrefslogtreecommitdiffstats
path: root/plugins/check_ups.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_ups.c')
-rw-r--r--plugins/check_ups.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index c711de20..e250ef9d 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -82,7 +82,7 @@
82#define UPSSTATUS_UNKOWN 32 82#define UPSSTATUS_UNKOWN 32
83 83
84int server_port = PORT; 84int server_port = PORT;
85char *server_address = NULL; 85char *server_address = "127.0.0.1";
86char *ups_name = NULL; 86char *ups_name = NULL;
87double warning_value = 0.0L; 87double warning_value = 0.0L;
88double critical_value = 0.0L; 88double critical_value = 0.0L;
@@ -103,7 +103,6 @@ int determine_supported_vars (void);
103int get_ups_variable (const char *, char *, int); 103int get_ups_variable (const char *, char *, int);
104 104
105int process_arguments (int, char **); 105int process_arguments (int, char **);
106int call_getopt (int, char **);
107int validate_arguments (void); 106int validate_arguments (void);
108void print_help (void); 107void print_help (void);
109void print_usage (void); 108void print_usage (void);
@@ -547,17 +546,13 @@ process_arguments (int argc, char **argv)
547 } 546 }
548 547
549 548
550 if (server_address == NULL) { 549 if (server_address == NULL && argc > optind) {
551 if (optind >= argc) { 550 if (is_host (argv[optind]))
552 server_address = strscpy (NULL, "127.0.0.1");
553 }
554 else if (is_host (argv[optind])) {
555 server_address = argv[optind++]; 551 server_address = argv[optind++];
556 } 552 else
557 else {
558 usage ("Invalid host name"); 553 usage ("Invalid host name");
559 }
560 } 554 }
555
561 return validate_arguments(); 556 return validate_arguments();
562} 557}
563 558