Code

Fix includes for gettext
[nagiosplug.git] / plugins / check_http.c
index 125052fe325a05b178b19f9678bee5d49c5ef177..5f96e31e78b23bc49e5f482f74a8a8850564b841 100644 (file)
@@ -21,7 +21,7 @@
 
 const char *progname = "check_http";
 const char *revision = "$Revision$";
-const char *copyright = "1999-2001";
+const char *copyright = "1999-2004";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
 #include "common.h"
@@ -145,7 +145,7 @@ main (int argc, char **argv)
        asprintf (&user_agent, "User-Agent: check_http/%s (nagios-plugins %s)",
                  clean_revstring (revision), VERSION);
 
-       if (process_arguments (argc, argv) != TRUE)
+       if (process_arguments (argc, argv) == ERROR)
                usage4 (_("Could not parse arguments"));
 
        if (strstr (timestamp, ":")) {
@@ -676,17 +676,17 @@ check_document_dates (const char *headers)
        } else if (!document_date || !*document_date) {
                die (STATE_CRITICAL, _("Document modification date unknown\n"));
        } else {
-               time_t sd = parse_time_string (server_date);
-               time_t dd = parse_time_string (document_date);
+               time_t srv_data = parse_time_string (server_date);
+               time_t doc_data = parse_time_string (document_date);
 
-               if (sd <= 0) {
+               if (srv_data <= 0) {
                        die (STATE_CRITICAL, _("CRITICAL - Server date \"%100s\" unparsable"), server_date);
-               } else if (dd <= 0) {
+               } else if (doc_data <= 0) {
                        die (STATE_CRITICAL, _("CRITICAL - Document date \"%100s\" unparsable"), document_date);
-               } else if (dd > sd + 30) {
-                       die (STATE_CRITICAL, _("CRITICAL - Document is %d seconds in the future\n"), dd - sd);
-               } else if (dd < sd - maximum_age) {
-               int n = (sd - dd);
+               } else if (doc_data > srv_data + 30) {
+                       die (STATE_CRITICAL, _("CRITICAL - Document is %d seconds in the future\n"), (int)doc_data - (int)srv_data);
+               } else if (doc_data < srv_data - maximum_age) {
+               int n = (srv_data - doc_data);
                if (n > (60 * 60 * 24 * 2))
                        die (STATE_CRITICAL,
                          _("CRITICAL - Last modified %.1f days ago\n"),
@@ -1376,7 +1376,7 @@ print_help (void)
 This plugin tests the HTTP service on the specified host. It can test\n\
 normal (http) and secure (https) servers, follow redirects, search for\n\
 strings and regular expressions, check connection times, and report on\n\
-certificate expiration times.\n"));
+certificate expiration times.\n\n"));
 
        print_usage ();
 
@@ -1490,13 +1490,11 @@ the certificate is expired.\n"));
 void
 print_usage (void)
 {
-       printf (_("\
-Usage: %s (-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\
-  [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
-  [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
-  [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
-  [-P string] [-m min_pg_size] [-4|-6] [-N] [-M <age>] [-A string]\n\
-  [-k string]\n"), progname);
-       
-       printf (UT_HLP_VRS, progname, progname);
+       printf ("\
+Usage: %s -H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\
+                  [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
+                  [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
+                  [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
+                  [-P string] [-m min_pg_size] [-4|-6] [-N] [-M <age>]\n\
+                  [-A string] [-k string]\n", progname);
 }