Code

markup for translation, move send_buffer assignment to process_args so process_tcp_re...
[nagiosplug.git] / plugins / utils.c
index d0999c5840c8baaebae33d1203186e64494a3af4..5f770a1f5a508c339238f45209bc829a36452131 100644 (file)
  * $Date$
  ****************************************************************************/
 
+#define LOCAL_TIMEOUT_ALARM_HANDLER
+
 #include "config.h"
 #include "common.h"
+#include "utils.h"
 #include <stdarg.h>
 #include <limits.h>
 
 #include <arpa/inet.h>
 
-extern int timeout_interval;
+extern void print_usage (void);
 extern const char *progname;
 
-void support (void);
-char *clean_revstring (const char *);
-void print_revision (const char *, const char *);
-void die (int result, const char *fmt, ...);
-void terminate (int result, const char *fmt, ...);
-RETSIGTYPE timeout_alarm_handler (int);
-
-int is_integer (char *);
-int is_intpos (char *);
-int is_intneg (char *);
-int is_intnonneg (char *);
-int is_intpercent (char *);
-
-int is_numeric (char *);
-int is_positive (char *);
-int is_negative (char *);
-int is_nonnegative (char *);
-int is_percentage (char *);
-
-int is_option (char *str);
-
-double delta_time (struct timeval tv);
-
-void strip (char *);
-char *strscpy (char *dest, const char *src);
-char *strscat (char *dest, char *src);
-char *strnl (char *str);
-char *strpcpy (char *dest, const char *src, const char *str);
-char *strpcat (char *dest, const char *src, const char *str);
-
-char *state_text (int result);
-
 #define STRLEN 64
 #define TXTBLK 128
 
 /* **************************************************************************
/* max_state(STATE_x, STATE_y)
+ * max_state(STATE_x, STATE_y)
  * compares STATE_x to  STATE_y and returns result based on the following
  * STATE_UNKNOWN < STATE_OK < STATE_WARNING < STATE_CRITICAL
  *
  * Note that numerically the above does not hold
  ****************************************************************************/
 
-#define max(a,b) (((a)>(b))?(a):(b))
-
 int
 max_state (int a, int b)
 {
@@ -109,10 +78,10 @@ usage3 (char *msg, char arg)
 void
 support (void)
 {
-       printf
-               ("Send email to nagios-users@lists.sourceforge.net if you have questions\n"
-                "regarding use of this software. To submit patches or suggest improvements,\n"
-                "send email to nagiosplug-devel@lists.sourceforge.net\n");
+       printf (_("\n\
+Send email to nagios-users@lists.sourceforge.net if you have questions\n\
+regarding use of this software. To submit patches or suggest improvements,\n\
+send email to nagiosplug-devel@lists.sourceforge.net\n"));
 }
 
 
@@ -133,12 +102,12 @@ print_revision (const char *command_name, const char *revision_string)
 
        if (sscanf (revision_string, "$Revision: %[0-9.]", plugin_revision) != 1)
                strncpy (plugin_revision, "N/A", STRLEN);
-       printf ("%s (nagios-plugins %s) %s\n",
-                                       progname, VERSION, plugin_revision);
-       printf
-               ("The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n"
-                "copies of the plugins under the terms of the GNU General Public License.\n"
-                "For more information about these matters, see the file named COPYING.\n");
+       printf ("%s (%s %s) %s\n",
+                                       command_name, PACKAGE, VERSION, plugin_revision);
+       printf (_("\
+The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n\
+copies of the plugins under the terms of the GNU General Public License.\n\
+For more information about these matters, see the file named COPYING.\n"));
 
 }
 
@@ -397,7 +366,7 @@ strscpy (char *dest, const char *src)
  *****************************************************************************/
 
 char *
-strscat (char *dest, char *src)
+strscat (char *dest, const char *src)
 {
 
        if (dest == NULL)