X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Futils.c;h=5f770a1f5a508c339238f45209bc829a36452131;hb=6f53b99720ebe05d801f814fda823ef7c885f869;hp=e63c8c08823021bf192d424b55d1ecfa5aa10382;hpb=33a6787f51503d1b24f42e57cf365a48378dd56e;p=nagiosplug.git diff --git a/plugins/utils.c b/plugins/utils.c index e63c8c0..5f770a1 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -11,61 +11,30 @@ * $Date$ ****************************************************************************/ +#define LOCAL_TIMEOUT_ALARM_HANDLER + #include "config.h" #include "common.h" +#include "utils.h" #include #include #include -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")); } @@ -134,11 +103,11 @@ 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 (%s %s) %s\n", - progname, 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"); + 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)