bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sharutils: patch for dirent.h


From: Bruce Korb
Subject: Re: sharutils: patch for dirent.h
Date: Mon, 15 May 2006 19:17:46 -0700
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

This is probably over the top, but here it is anyway.
configure.ac has been altered to fail if no directory entry header
is found and whichever is found gets inserted into config.h as
a #defined value for DIRENT_HEADER.  Other than DOS (naturally),
#include DIRENT_HEADER replaces all the alternating code that
re-figures out whatever it was that the configure script already
figured out.

For the curious (adventurous?):

 http://autogen.sourceforge.net/data/sharutils-4.6.3-pre3.tar.gz

Cheers - Bruce

Index: configure.ac
===================================================================
RCS file: /sources/sharutils/sharutils/configure.ac,v
retrieving revision 1.37
diff -b -B -u -p -c -r1.37 configure.ac
*** configure.ac    28 Aug 2005 00:21:32 -0000    1.37
--- configure.ac    16 May 2006 02:11:40 -0000
*************** AC_C_BIGENDIAN
*** 65,70 ****
--- 65,77 ----

 AC_CHECK_HEADERS(limits.h locale.h memory.h string.h sys/wait.h unistd.h)
 AC_HEADER_DIRENT
+ [test X$ac_header_dirent = Xno && {]
+   AC_MSG_ERROR([a dirent directory is required.])
+ [}
+ DIRENT_HEADER=\<${ac_header_dirent}\>]
+ AC_DEFINE_UNQUOTED(DIRENT_HEADER, [${DIRENT_HEADER}],
+          [define to directory entry header file])
+ AC_SUBST(DIRENT_HEADER)
 AC_HEADER_STAT
 AC_HEADER_STDC
 AC_STRUCT_TIMEZONE
Index: src/shar.c
===================================================================
RCS file: /sources/sharutils/sharutils/src/shar.c,v
retrieving revision 1.45
diff -b -B -u -p -c -r1.45 shar.c
*** src/shar.c    14 May 2006 23:12:23 -0000    1.45
--- src/shar.c    16 May 2006 02:11:40 -0000
*************** struct tm *localtime ();
*** 117,148 ****

 #ifdef __MSDOS__
 # include "msd_dir.h"
- # define NAMLEN(dirent) ((dirent)->d_namlen)
 #else
! # 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
 #endif

- DIR *opendir ();
- #ifndef readdir
-   /* why is this declared here anyway? */
-   struct dirent *readdir ();
- #endif
-
 #endif /* !NO_WALKTREE */
 
 /* Option variables.  */
--- 117,135 ----

 #ifdef __MSDOS__
 # include "msd_dir.h"
 #else
! # include DIRENT_HEADER
! #endif
!
! #if HAVE_DIRENT_H
 # define NAMLEN(dirent) (strlen((dirent)->d_name))
! #else
 # define NAMLEN(dirent) ((dirent)->d_namlen)
! # ifndef __MSDOS__
! #  define dirent direct
 # endif
 #endif

 #endif /* !NO_WALKTREE */
 
 /* Option variables.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]