diff options
Diffstat (limited to 'plugins/check_ups.c')
-rw-r--r-- | plugins/check_ups.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index c711de2..e250ef9 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 | ||
84 | int server_port = PORT; | 84 | int server_port = PORT; |
85 | char *server_address = NULL; | 85 | char *server_address = "127.0.0.1"; |
86 | char *ups_name = NULL; | 86 | char *ups_name = NULL; |
87 | double warning_value = 0.0L; | 87 | double warning_value = 0.0L; |
88 | double critical_value = 0.0L; | 88 | double critical_value = 0.0L; |
@@ -103,7 +103,6 @@ int determine_supported_vars (void); | |||
103 | int get_ups_variable (const char *, char *, int); | 103 | int get_ups_variable (const char *, char *, int); |
104 | 104 | ||
105 | int process_arguments (int, char **); | 105 | int process_arguments (int, char **); |
106 | int call_getopt (int, char **); | ||
107 | int validate_arguments (void); | 106 | int validate_arguments (void); |
108 | void print_help (void); | 107 | void print_help (void); |
109 | void print_usage (void); | 108 | void 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 | ||