summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 033f54c)
raw | patch | inline | side by side (parent: 033f54c)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 11 May 2002 09:09:57 +0000 (09:09 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 11 May 2002 09:09:57 +0000 (09:09 +0000) |
program/configure.ac | patch | blob | history | |
program/src/rrd_tool.c | patch | blob | history | |
program/src/rrd_tool.h | patch | blob | history |
diff --git a/program/configure.ac b/program/configure.ac
index ea2c83905f2492feeeeb6a35967595de35280155..9c9fe258818ef1f9d539b35125f180d0672c1c64 100644 (file)
--- a/program/configure.ac
+++ b/program/configure.ac
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h time.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h float.h)
+AC_HEADER_DIRENT
+AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h time.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h float.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c
index 41cf3cde0376f763e0f596eb714f018fbc762788..4a6c8cd75938ace45b41daffafcdb5b861d8d177 100644 (file)
--- a/program/src/rrd_tool.c
+++ b/program/src/rrd_tool.c
printf("d %s\n",dent->d_name);
}
if (strlen(dent->d_name)>4 && S_ISREG(st.st_mode)){
- if (!strcmp(dent->d_name+strlen(dent->d_name)-4,".rrd") ||
- !strcmp(dent->d_name+strlen(dent->d_name)-4,".RRD")){
+ if (!strcmp(dent->d_name+NAMLEN(dent)-4,".rrd") ||
+ !strcmp(dent->d_name+NAMLEN(dent)-4,".RRD")){
printf("- %s\n",dent->d_name);
}
}
diff --git a/program/src/rrd_tool.h b/program/src/rrd_tool.h
index 780cd05ea9054403167084e1c686496342347fcb..7280e7448c1a9d3d7b47def89efad0810eb2ffed 100644 (file)
--- a/program/src/rrd_tool.h
+++ b/program/src/rrd_tool.h
/* Sorry: don't know autoconf as well how to check the exist of
dirent.h ans sys/stat.h
*/
-#include <sys/stat.h>
-#include <dirent.h>
-#include <sys/types.h>
-/*
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
#endif
-*/
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+
#if HAVE_UNISTD_H
# include <unistd.h>
#endif