diff options
author | Benoit Mortier <opensides@users.sourceforge.net> | 2004-12-03 16:56:27 +0000 |
---|---|---|
committer | Benoit Mortier <opensides@users.sourceforge.net> | 2004-12-03 16:56:27 +0000 |
commit | 2ad398d2e04717ce3a6a8fb869e855c42581a30a (patch) | |
tree | a9230435f6a718f6b52e0c909846557bf19ce6b5 /plugins/check_procs.c | |
parent | fa002886e390f5cc603021e422be3c319a1040ea (diff) | |
download | monitoring-plugins-2ad398d2e04717ce3a6a8fb869e855c42581a30a.tar.gz |
fixes for internationalization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@990 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_procs.c')
-rw-r--r-- | plugins/check_procs.c | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index a8a7d5e8..ee168db2 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -589,6 +589,71 @@ check_thresholds (int value) + +/* convert the elapsed time to seconds */ +int +convert_to_seconds(char *etime) { + + char *ptr; + int total; + + int hyphcnt; + int coloncnt; + int days; + int hours; + int minutes; + int seconds; + + hyphcnt = 0; + coloncnt = 0; + days = 0; + hours = 0; + minutes = 0; + seconds = 0; + + for (ptr = etime; *ptr != '\0'; ptr++) { + + if (*ptr == '-') { + hyphcnt++; + continue; + } + if (*ptr == ':') { + coloncnt++; + continue; + } + } + + if (hyphcnt > 0) { + sscanf(etime, "%d-%d:%d:%d", + &days, &hours, &minutes, &seconds); + /* linux 2.6.5/2.6.6 reporting some processes with infinite + * elapsed times for some reason */ + if (days == 49710) { + return 0; + } + } else { + if (coloncnt == 2) { + sscanf(etime, "%d:%d:%d", + &hours, &minutes, &seconds); + } else if (coloncnt == 1) { + sscanf(etime, "%d:%d", + &minutes, &seconds); + } + } + + total = (days * 86400) + + (hours * 3600) + + (minutes * 60) + + seconds; + + if (verbose >= 3) { + printf("seconds: %d\n", total); + } + return total; +} + + + void print_help (void) { @@ -681,78 +746,13 @@ Examples:\n\ printf (_(UT_SUPPORT)); } - - -/* convert the elapsed time to seconds */ -int -convert_to_seconds(char *etime) { - - char *ptr; - int total; - - int hyphcnt; - int coloncnt; - int days; - int hours; - int minutes; - int seconds; - - hyphcnt = 0; - coloncnt = 0; - days = 0; - hours = 0; - minutes = 0; - seconds = 0; - - for (ptr = etime; *ptr != '\0'; ptr++) { - - if (*ptr == '-') { - hyphcnt++; - continue; - } - if (*ptr == ':') { - coloncnt++; - continue; - } - } - - if (hyphcnt > 0) { - sscanf(etime, "%d-%d:%d:%d", - &days, &hours, &minutes, &seconds); - /* linux 2.6.5/2.6.6 reporting some processes with infinite - * elapsed times for some reason */ - if (days == 49710) { - return 0; - } - } else { - if (coloncnt == 2) { - sscanf(etime, "%d:%d:%d", - &hours, &minutes, &seconds); - } else if (coloncnt == 1) { - sscanf(etime, "%d:%d", - &minutes, &seconds); - } - } - - total = (days * 86400) + - (hours * 3600) + - (minutes * 60) + - seconds; - - if (verbose >= 3) { - printf("seconds: %d\n", total); - } - return total; -} - void print_usage (void) { printf ("\ Usage: %s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n\ [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n\ - [-C command] [-t timeout] [-v]\n", progname); - printf (_(UT_HLP_VRS), progname, progname); + [-C command] [-t timeout] [-v]\n", progname); + + printf (UT_HLP_VRS, progname, progname); } - - |