diff options
author | Raja R Harinath <harinath@src.gnome.org> | 1998-04-13 23:39:05 +0000 |
---|---|---|
committer | Raja R Harinath <harinath@src.gnome.org> | 1998-04-13 23:39:05 +0000 |
commit | 70dd5b3b142123b882d85a41d21592a79c079428 (patch) | |
tree | c6ae3199bb56f190683411dda9097d668e7cbc86 | |
parent | 4d77e46422bb506be06fb6695c343befb64b5a58 (diff) | |
download | gnome-common-70dd5b3b142123b882d85a41d21592a79c079428.tar.gz |
Include. Do all the `dirent' wrangling only if `scandir' is needed. Also,
* scandir.c (<sys/types.h>): Include.
* gnomesupport-h.c (!HAVE_SCANDIR): Do all the `dirent' wrangling
only if `scandir' is needed. Also, include <sys/types.h> in all
cases.
svn path=/trunk/; revision=192
-rw-r--r-- | support/ChangeLog | 12 | ||||
-rw-r--r-- | support/gnomesupport-h.c | 26 | ||||
-rw-r--r-- | support/scandir.c | 1 |
3 files changed, 30 insertions, 9 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index 3175003..bf965d5 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,15 @@ +1998-04-13 Raja R Harinath <harinath@cs.umn.edu> + + * scandir.c (<sys/types.h>): Include. + * gnomesupport-h.c (!HAVE_SCANDIR): Do all the `dirent' wrangling + only if `scandir' is needed. Also, include <sys/types.h> in all + cases. + +1998-04-13 Seth Alves <alves@twitch.cp.domain.net> + + * gnomesupport-h.c (HAVE_DIRENT_H): FreeBSD needs <sys/types.h> + before <dirent.h>. + 1998-04-12 Raja R Harinath <harinath@cs.umn.edu> * Makefile.am (supportincludedir): Is now $(pkglibdir)/include. diff --git a/support/gnomesupport-h.c b/support/gnomesupport-h.c index d6339e7..bab0235 100644 --- a/support/gnomesupport-h.c +++ b/support/gnomesupport-h.c @@ -37,35 +37,43 @@ extern \"C\" { "); #endif -#if HAVE_DIRENT_H +#ifndef HAVE_SCANDIR + /* FreeBSD apparently needs this before <dirent.h>. + Anyway, it is a good idea to include <sys/types.h> before including + any other <sys/...> header. */ puts("\ #include <sys/types.h> "); + + /* The following tests and #defines are based on the tests suggested + for AC_HEADER_DIRENT in the autoconf manual. */ +# if HAVE_DIRENT_H puts("\ #include <dirent.h> #define NAMLEN(dirent) strlen((dirent)->d_name) "); -#else +# else /* not HAVE_DIRENT_H */ puts("\ #define dirent direct #define NAMLEN(dirent) (dirent)->d_namlen "); -# if HAVE_SYS_NDIR_H +# if HAVE_SYS_NDIR_H puts("\ #include <sys/ndir.h> "); -# endif -# if HAVE_SYS_DIR_H +# endif /* HAVE_SYS_NDIR_H */ +# if HAVE_SYS_DIR_H puts("\ #include <sys/dir.h> "); -# endif -# if HAVE_NDIR_H +# endif /* HAVE_SYS_DIR_H */ +# if HAVE_NDIR_H puts("\ #include <ndir.h> "); -# endif -#endif +# endif /* HAVE_NDIR_H */ +# endif /* not HAVE_DIRENT_H */ +#endif /* not HAVE_SCANDIR */ puts("\ #undef PARAMS diff --git a/support/scandir.c b/support/scandir.c index 26fe361..1b45e37 100644 --- a/support/scandir.c +++ b/support/scandir.c @@ -22,6 +22,7 @@ #include <stdlib.h> #include <string.h> #include <errno.h> +#include <sys/types.h> #if HAVE_DIRENT_H # include <dirent.h> |