summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_procs.c2
-rw-r--r--plugins/utils.c27
-rw-r--r--plugins/utils.h3
3 files changed, 1 insertions, 31 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index f6438f27..82a21eb2 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -189,7 +189,7 @@ main (int argc, char **argv)
189 strip (procargs); 189 strip (procargs);
190 190
191 /* Some ps return full pathname for command. This removes path */ 191 /* Some ps return full pathname for command. This removes path */
192 procprog = basename(procprog); 192 procprog = base_name(procprog);
193 193
194 /* we need to convert the elapsed time to seconds */ 194 /* we need to convert the elapsed time to seconds */
195 procseconds = convert_to_seconds(procetime); 195 procseconds = convert_to_seconds(procetime);
diff --git a/plugins/utils.c b/plugins/utils.c
index a455f225..cb013412 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -640,33 +640,6 @@ strpcat (char *dest, const char *src, const char *str)
640 return dest; 640 return dest;
641} 641}
642 642
643#ifndef HAVE_BASENAME
644/* function modified from coreutils base_name function - see ACKNOWLEDGEMENTS */
645char *basename(const char *path) {
646 char const *base = path;
647 char const *p;
648 for (p = base; *p; p++) {
649 if (*p == '/') {
650 /* Treat multiple adjacent slashes like single slash */
651 do p++;
652 while (*p == '/');
653
654 /* If filename ends in slash, use trailing slash
655 as basename if no non-slashes found */
656 if (! *p) {
657 if (*base == '/')
658 base = p - 1;
659 break;
660 }
661
662 /* *p is non-slash preceded by slash */
663 base = p;
664 }
665 }
666 return (char *) base;
667}
668#endif
669
670/****************************************************************************** 643/******************************************************************************
671 * 644 *
672 * Print perfdata in a standard format 645 * Print perfdata in a standard format
diff --git a/plugins/utils.h b/plugins/utils.h
index ed6243df..4bbe33d0 100644
--- a/plugins/utils.h
+++ b/plugins/utils.h
@@ -80,9 +80,6 @@ void set_thresholds(thresholds **, char *, char *);
80int check_range(double, range *); 80int check_range(double, range *);
81int get_status(double, thresholds *); 81int get_status(double, thresholds *);
82 82
83/* I think this needs to be defined even if you use the system version */
84char *basename(const char *path);
85
86#ifndef HAVE_GETTIMEOFDAY 83#ifndef HAVE_GETTIMEOFDAY
87int gettimeofday(struct timeval *, struct timezone *); 84int gettimeofday(struct timeval *, struct timezone *);
88#endif 85#endif