Import filemode module from gnulib.

This commit is contained in:
Paul Eggert 2011-02-21 09:56:37 -08:00
commit 5c185672d6
21 changed files with 1482 additions and 270 deletions

View file

@ -1,3 +1,18 @@
2011-02-20 Paul Eggert <eggert@cs.ucla.edu>
Import filemode module from gnulib.
* .bzrignore: Add lib/sys/.
* Makefile.in (GNULIB_MODULES): Add filemode.
* lib/Makefile.am (MOSTLYCLEANDIRS): New macro.
* lib/filemode.c: Renamed from src/filemode.c and regenerated
from gnulib. This adds support for some more file types, e.g.,
Cray DMF migrated files.
* lisp/emacs-lisp/find-gc.el (find-gc-source-files): Remove filemode.c.
* lib/filemode.h, lib/sys_stat.in.h, m4/filemode.m4, m4/st_dm_mode.m4:
* m4/sys_stat_h.m4: New files, generated from gnulib.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4:
Regenerate.
2011-02-20 Eli Zaretskii <eliz@gnu.org>
* lib/makefile.w32-in ($(BLD)/md5.$(O)): Don't depend on

View file

@ -331,7 +331,8 @@ DOS_gnulib_comp.m4 = gl-comp.m4
# $(gnulib_srcdir) (relative to $(srcdir) and should have build tools
# as per $(gnulib_srcdir)/DEPENDENCIES.
GNULIB_MODULES = \
crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime
crypto/md5 dtoastr filemode getloadavg getopt-gnu \
ignore-value mktime strftime
GNULIB_TOOL_FLAGS = \
--import --no-changelog --no-vc-files --makefile-name=gnulib.mk
sync-from-gnulib: $(gnulib_srcdir)

3
aclocal.m4 vendored
View file

@ -987,6 +987,7 @@ AC_SUBST([am__untar])
m4_include([m4/00gnulib.m4])
m4_include([m4/c-strtod.m4])
m4_include([m4/extensions.m4])
m4_include([m4/filemode.m4])
m4_include([m4/getloadavg.m4])
m4_include([m4/getopt.m4])
m4_include([m4/gl-comp.m4])
@ -996,11 +997,13 @@ m4_include([m4/longlong.m4])
m4_include([m4/md5.m4])
m4_include([m4/mktime.m4])
m4_include([m4/multiarch.m4])
m4_include([m4/st_dm_mode.m4])
m4_include([m4/stdbool.m4])
m4_include([m4/stddef_h.m4])
m4_include([m4/stdint.m4])
m4_include([m4/stdlib_h.m4])
m4_include([m4/strftime.m4])
m4_include([m4/sys_stat_h.m4])
m4_include([m4/time_h.m4])
m4_include([m4/time_r.m4])
m4_include([m4/tm_gmtoff.m4])

260
configure vendored
View file

@ -677,6 +677,40 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC
TIME_H_DEFINES_STRUCT_TIMESPEC
NEXT_AS_FIRST_DIRECTIVE_TIME_H
NEXT_TIME_H
NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H
NEXT_SYS_STAT_H
REPLACE_UTIMENSAT
REPLACE_STAT
REPLACE_MKNOD
REPLACE_MKFIFO
REPLACE_MKDIR
REPLACE_LSTAT
REPLACE_FUTIMENS
REPLACE_FSTATAT
REPLACE_FSTAT
HAVE_UTIMENSAT
HAVE_MKNODAT
HAVE_MKNOD
HAVE_MKFIFOAT
HAVE_MKFIFO
HAVE_MKDIRAT
HAVE_LSTAT
HAVE_LCHMOD
HAVE_FUTIMENS
HAVE_FSTATAT
HAVE_FCHMODAT
GNULIB_UTIMENSAT
GNULIB_STAT
GNULIB_MKNODAT
GNULIB_MKNOD
GNULIB_MKFIFOAT
GNULIB_MKFIFO
GNULIB_MKDIRAT
GNULIB_LSTAT
GNULIB_LCHMOD
GNULIB_FUTIMENS
GNULIB_FSTATAT
GNULIB_FCHMODAT
NEXT_AS_FIRST_DIRECTIVE_STDLIB_H
NEXT_STDLIB_H
STDINT_H
@ -2926,6 +2960,7 @@ as_fn_append ac_func_list " alarm"
as_fn_append ac_header_list " wchar.h"
as_fn_append ac_header_list " stdint.h"
as_fn_append ac_func_list " tzset"
as_fn_append ac_header_list " sys/stat.h"
as_fn_append ac_header_list " sys/time.h"
as_fn_append ac_func_list " localtime_r"
# Check that the precious variables saved in the cache have kept the same
@ -6089,6 +6124,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
# Code from module dtoastr:
# Code from module extensions:
# Code from module filemode:
# Code from module getloadavg:
# Code from module getopt-gnu:
# Code from module getopt-posix:
@ -6103,6 +6139,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
# Code from module stdint:
# Code from module stdlib:
# Code from module strftime:
# Code from module sys_stat:
# Code from module time:
# Code from module time_r:
# Code from module unistd:
@ -13687,6 +13724,52 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_dm_mode in struct stat" >&5
$as_echo_n "checking for st_dm_mode in struct stat... " >&6; }
if ${ac_cv_struct_st_dm_mode+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/stat.h>
int
main ()
{
struct stat s; s.st_dm_mode;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_struct_st_dm_mode=yes
else
ac_cv_struct_st_dm_mode=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_st_dm_mode" >&5
$as_echo "$ac_cv_struct_st_dm_mode" >&6; }
if test $ac_cv_struct_st_dm_mode = yes; then
$as_echo "#define HAVE_ST_DM_MODE 1" >>confdefs.h
fi
ac_fn_c_check_decl "$LINENO" "strmode" "ac_cv_have_decl_strmode" "$ac_includes_default"
if test "x$ac_cv_have_decl_strmode" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRMODE $ac_have_decl
_ACEOF
GNULIB__EXIT=0;
GNULIB_ATOLL=0;
@ -14739,6 +14822,84 @@ fi
GNULIB_FCHMODAT=0;
GNULIB_FSTATAT=0;
GNULIB_FUTIMENS=0;
GNULIB_LCHMOD=0;
GNULIB_LSTAT=0;
GNULIB_MKDIRAT=0;
GNULIB_MKFIFO=0;
GNULIB_MKFIFOAT=0;
GNULIB_MKNOD=0;
GNULIB_MKNODAT=0;
GNULIB_STAT=0;
GNULIB_UTIMENSAT=0;
HAVE_FCHMODAT=1;
HAVE_FSTATAT=1;
HAVE_FUTIMENS=1;
HAVE_LCHMOD=1;
HAVE_LSTAT=1;
HAVE_MKDIRAT=1;
HAVE_MKFIFO=1;
HAVE_MKFIFOAT=1;
HAVE_MKNOD=1;
HAVE_MKNODAT=1;
HAVE_UTIMENSAT=1;
REPLACE_FSTAT=0;
REPLACE_FSTATAT=0;
REPLACE_FUTIMENS=0;
REPLACE_LSTAT=0;
REPLACE_MKDIR=0;
REPLACE_MKFIFO=0;
REPLACE_MKNOD=0;
REPLACE_STAT=0;
REPLACE_UTIMENSAT=0;
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
$as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
if ${ac_cv_header_stat_broken+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/stat.h>
#if defined S_ISBLK && defined S_IFDIR
extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1];
#endif
#if defined S_ISBLK && defined S_IFCHR
extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1];
#endif
#if defined S_ISLNK && defined S_IFREG
extern char c3[S_ISLNK (S_IFREG) ? -1 : 1];
#endif
#if defined S_ISSOCK && defined S_IFREG
extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1];
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stat_broken=no
else
ac_cv_header_stat_broken=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5
$as_echo "$ac_cv_header_stat_broken" >&6; }
if test $ac_cv_header_stat_broken = yes; then
$as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
if ${ac_cv_c_restrict+:} false; then :
@ -15002,6 +15163,21 @@ fi
# Code from module dtoastr:
# Code from module extensions:
# Code from module filemode:
gl_LIBOBJS="$gl_LIBOBJS filemode.$ac_objext"
# Code from module getloadavg:
@ -16752,6 +16928,90 @@ $as_echo "#define my_strftime nstrftime" >>confdefs.h
# Code from module sys_stat:
if test $gl_cv_have_include_next = yes; then
gl_cv_next_sys_stat_h='<'sys/stat.h'>'
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/stat.h>" >&5
$as_echo_n "checking absolute name of <sys/stat.h>... " >&6; }
if ${gl_cv_next_sys_stat_h+:} false; then :
$as_echo_n "(cached) " >&6
else
if test $ac_cv_header_sys_stat_h = yes; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/stat.h>
_ACEOF
case "$host_os" in
aix*) gl_absname_cpp="$ac_cpp -C" ;;
*) gl_absname_cpp="$ac_cpp" ;;
esac
gl_cv_next_sys_stat_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
sed -n '\#/sys/stat.h#{
s#.*"\(.*/sys/stat.h\)".*#\1#
s#^/[^/]#//&#
p
q
}'`'"'
else
gl_cv_next_sys_stat_h='<'sys/stat.h'>'
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5
$as_echo "$gl_cv_next_sys_stat_h" >&6; }
fi
NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h
if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
gl_next_as_first_directive='<'sys/stat.h'>'
else
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
gl_next_as_first_directive=$gl_cv_next_sys_stat_h
fi
NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive
ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include <sys/types.h>
#include <sys/stat.h>
"
if test "x$ac_cv_type_nlink_t" = xyes; then :
else
$as_echo "#define nlink_t int" >>confdefs.h
fi
# Code from module time:

View file

@ -1,5 +1,6 @@
BUILT_SOURCES =
EXTRA_DIST =
MOSTLYCLEANDIRS =
MOSTLYCLEANFILES =
noinst_LIBRARIES =

View file

@ -24,7 +24,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
@ -51,13 +51,15 @@ subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
$(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \
$(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \
$(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \
$(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \
$(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \
$(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \
$(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \
$(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
$(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \
$(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/st_dm_mode.m4 \
$(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
$(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdlib_h.m4 \
$(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/sys_stat_h.m4 \
$(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
$(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \
$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in
@ -152,9 +154,12 @@ GNULIB_ENVIRON = @GNULIB_ENVIRON@
GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@
GNULIB_FACCESSAT = @GNULIB_FACCESSAT@
GNULIB_FCHDIR = @GNULIB_FCHDIR@
GNULIB_FCHMODAT = @GNULIB_FCHMODAT@
GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@
GNULIB_FSTATAT = @GNULIB_FSTATAT@
GNULIB_FSYNC = @GNULIB_FSYNC@
GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
GNULIB_FUTIMENS = @GNULIB_FUTIMENS@
GNULIB_GETCWD = @GNULIB_GETCWD@
GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@
GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@
@ -167,12 +172,19 @@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@
GNULIB_GRANTPT = @GNULIB_GRANTPT@
GNULIB_LCHMOD = @GNULIB_LCHMOD@
GNULIB_LCHOWN = @GNULIB_LCHOWN@
GNULIB_LINK = @GNULIB_LINK@
GNULIB_LINKAT = @GNULIB_LINKAT@
GNULIB_LSEEK = @GNULIB_LSEEK@
GNULIB_LSTAT = @GNULIB_LSTAT@
GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
GNULIB_MKDIRAT = @GNULIB_MKDIRAT@
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
GNULIB_MKFIFO = @GNULIB_MKFIFO@
GNULIB_MKFIFOAT = @GNULIB_MKFIFOAT@
GNULIB_MKNOD = @GNULIB_MKNOD@
GNULIB_MKNODAT = @GNULIB_MKNODAT@
GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@
GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
@ -194,6 +206,7 @@ GNULIB_RMDIR = @GNULIB_RMDIR@
GNULIB_RPMATCH = @GNULIB_RPMATCH@
GNULIB_SETENV = @GNULIB_SETENV@
GNULIB_SLEEP = @GNULIB_SLEEP@
GNULIB_STAT = @GNULIB_STAT@
GNULIB_STRPTIME = @GNULIB_STRPTIME@
GNULIB_STRTOD = @GNULIB_STRTOD@
GNULIB_STRTOLL = @GNULIB_STRTOLL@
@ -211,6 +224,7 @@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@
GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@
GNULIB_UNSETENV = @GNULIB_UNSETENV@
GNULIB_USLEEP = @GNULIB_USLEEP@
GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@
GNULIB_WRITE = @GNULIB_WRITE@
GNULIB__EXIT = @GNULIB__EXIT@
GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@
@ -239,9 +253,12 @@ HAVE_DUP3 = @HAVE_DUP3@
HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
HAVE_FACCESSAT = @HAVE_FACCESSAT@
HAVE_FCHDIR = @HAVE_FCHDIR@
HAVE_FCHMODAT = @HAVE_FCHMODAT@
HAVE_FCHOWNAT = @HAVE_FCHOWNAT@
HAVE_FSTATAT = @HAVE_FSTATAT@
HAVE_FSYNC = @HAVE_FSYNC@
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
HAVE_FUTIMENS = @HAVE_FUTIMENS@
HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@
HAVE_GETGROUPS = @HAVE_GETGROUPS@
HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@
@ -251,12 +268,19 @@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_GRANTPT = @HAVE_GRANTPT@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_LCHMOD = @HAVE_LCHMOD@
HAVE_LCHOWN = @HAVE_LCHOWN@
HAVE_LINK = @HAVE_LINK@
HAVE_LINKAT = @HAVE_LINKAT@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_LSTAT = @HAVE_LSTAT@
HAVE_MAKEINFO = @HAVE_MAKEINFO@
HAVE_MKDIRAT = @HAVE_MKDIRAT@
HAVE_MKDTEMP = @HAVE_MKDTEMP@
HAVE_MKFIFO = @HAVE_MKFIFO@
HAVE_MKFIFOAT = @HAVE_MKFIFOAT@
HAVE_MKNOD = @HAVE_MKNOD@
HAVE_MKNODAT = @HAVE_MKNODAT@
HAVE_MKOSTEMP = @HAVE_MKOSTEMP@
HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@
HAVE_MKSTEMP = @HAVE_MKSTEMP@
@ -298,6 +322,7 @@ HAVE_UNLINKAT = @HAVE_UNLINKAT@
HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
HAVE_USLEEP = @HAVE_USLEEP@
HAVE_UTIMENSAT = @HAVE_UTIMENSAT@
HAVE_WCHAR_H = @HAVE_WCHAR_H@
HAVE_WCHAR_T = @HAVE_WCHAR_T@
HAVE_XSERVER = @HAVE_XSERVER@
@ -369,12 +394,14 @@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@
NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
NEXT_GETOPT_H = @NEXT_GETOPT_H@
NEXT_STDDEF_H = @NEXT_STDDEF_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
NEXT_TIME_H = @NEXT_TIME_H@
NEXT_UNISTD_H = @NEXT_UNISTD_H@
NS_OBJ = @NS_OBJ@
@ -410,6 +437,9 @@ REPLACE_CLOSE = @REPLACE_CLOSE@
REPLACE_DUP = @REPLACE_DUP@
REPLACE_DUP2 = @REPLACE_DUP2@
REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
REPLACE_FSTAT = @REPLACE_FSTAT@
REPLACE_FSTATAT = @REPLACE_FSTATAT@
REPLACE_FUTIMENS = @REPLACE_FUTIMENS@
REPLACE_GETCWD = @REPLACE_GETCWD@
REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@
REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
@ -420,7 +450,11 @@ REPLACE_LINK = @REPLACE_LINK@
REPLACE_LINKAT = @REPLACE_LINKAT@
REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
REPLACE_LSEEK = @REPLACE_LSEEK@
REPLACE_LSTAT = @REPLACE_LSTAT@
REPLACE_MALLOC = @REPLACE_MALLOC@
REPLACE_MKDIR = @REPLACE_MKDIR@
REPLACE_MKFIFO = @REPLACE_MKFIFO@
REPLACE_MKNOD = @REPLACE_MKNOD@
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
REPLACE_MKTIME = @REPLACE_MKTIME@
REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
@ -434,6 +468,7 @@ REPLACE_REALPATH = @REPLACE_REALPATH@
REPLACE_RMDIR = @REPLACE_RMDIR@
REPLACE_SETENV = @REPLACE_SETENV@
REPLACE_SLEEP = @REPLACE_SLEEP@
REPLACE_STAT = @REPLACE_STAT@
REPLACE_STRTOD = @REPLACE_STRTOD@
REPLACE_SYMLINK = @REPLACE_SYMLINK@
REPLACE_TIMEGM = @REPLACE_TIMEGM@
@ -442,6 +477,7 @@ REPLACE_UNLINK = @REPLACE_UNLINK@
REPLACE_UNLINKAT = @REPLACE_UNLINKAT@
REPLACE_UNSETENV = @REPLACE_UNSETENV@
REPLACE_USLEEP = @REPLACE_USLEEP@
REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@
REPLACE_WRITE = @REPLACE_WRITE@
RSVG_CFLAGS = @RSVG_CFLAGS@
RSVG_LIBS = @RSVG_LIBS@
@ -559,25 +595,27 @@ x_default_search_path = @x_default_search_path@
# present in all Makefile.am that need it. This is ensured by the applicability
# 'all' defined above.
BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \
$(STDDEF_H) $(STDINT_H) stdlib.h time.h unistd.h warn-on-use.h
$(STDDEF_H) $(STDINT_H) stdlib.h sys/stat.h time.h unistd.h \
warn-on-use.h
EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \
md5.c md5.h ftoastr.c ftoastr.h getloadavg.c getopt.c \
getopt.in.h getopt1.c getopt_int.h intprops.h \
mktime-internal.h mktime.c stdbool.in.h stddef.in.h \
stdint.in.h stdlib.in.h strftime.c strftime.h time.in.h \
time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
md5.c md5.h ftoastr.c ftoastr.h filemode.c filemode.h \
getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \
intprops.h mktime-internal.h mktime.c stdbool.in.h stddef.in.h \
stdint.in.h stdlib.in.h strftime.c strftime.h sys_stat.in.h \
time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
MOSTLYCLEANDIRS = sys
MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \
c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \
stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdlib.h \
stdlib.h-t time.h time.h-t unistd.h unistd.h-t warn-on-use.h \
warn-on-use.h-t
stdlib.h-t sys/stat.h sys/stat.h-t time.h time.h-t unistd.h \
unistd.h-t warn-on-use.h warn-on-use.h-t
noinst_LIBRARIES = libgnu.a
DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src
libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h
libgnu_a_LIBADD = $(gl_LIBOBJS)
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c getloadavg.c getopt.c \
getopt1.c mktime.c strftime.c time_r.c
EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c filemode.c getloadavg.c \
getopt.c getopt1.c mktime.c strftime.c time_r.c
ARG_NONNULL_H = arg-nonnull.h
CXXDEFS_H = c++defs.h
WARN_ON_USE_H = warn-on-use.h
@ -631,6 +669,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
@ -1021,6 +1060,55 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
} > $@-t && \
mv $@-t $@
# We need the following in order to create <sys/stat.h> when the system
# has one that is incomplete.
sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
-e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
-e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \
-e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
-e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
-e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \
-e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \
-e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \
-e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \
-e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \
-e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \
-e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \
-e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
-e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
-e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
-e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
-e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
-e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \
-e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \
-e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \
-e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
-e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
-e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
-e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
-e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
-e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
-e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
-e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
-e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
-e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
-e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
-e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/sys_stat.in.h; \
} > $@-t && \
mv $@-t $@
# We need the following in order to create <time.h> when the system
# doesn't have one that works with the given compiler.
time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)

180
lib/filemode.c Normal file
View file

@ -0,0 +1,180 @@
/* filemode.c -- make a string describing file modes
Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2011 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "filemode.h"
/* The following is for Cray DMF (Data Migration Facility), which is a
HSM file system. A migrated file has a `st_dm_mode' that is
different from the normal `st_mode', so any tests for migrated
files should use the former. */
#if HAVE_ST_DM_MODE
# define IS_MIGRATED_FILE(statp) \
(S_ISOFD (statp->st_dm_mode) || S_ISOFL (statp->st_dm_mode))
#else
# define IS_MIGRATED_FILE(statp) 0
#endif
#if ! HAVE_DECL_STRMODE
/* Return a character indicating the type of file described by
file mode BITS:
'-' regular file
'b' block special file
'c' character special file
'C' high performance ("contiguous data") file
'd' directory
'D' door
'l' symbolic link
'm' multiplexed file (7th edition Unix; obsolete)
'n' network special file (HP-UX)
'p' fifo (named pipe)
'P' port
's' socket
'w' whiteout (4.4BSD)
'?' some other file type */
static char
ftypelet (mode_t bits)
{
/* These are the most common, so test for them first. */
if (S_ISREG (bits))
return '-';
if (S_ISDIR (bits))
return 'd';
/* Other letters standardized by POSIX 1003.1-2004. */
if (S_ISBLK (bits))
return 'b';
if (S_ISCHR (bits))
return 'c';
if (S_ISLNK (bits))
return 'l';
if (S_ISFIFO (bits))
return 'p';
/* Other file types (though not letters) standardized by POSIX. */
if (S_ISSOCK (bits))
return 's';
/* Nonstandard file types. */
if (S_ISCTG (bits))
return 'C';
if (S_ISDOOR (bits))
return 'D';
if (S_ISMPB (bits) || S_ISMPC (bits))
return 'm';
if (S_ISNWK (bits))
return 'n';
if (S_ISPORT (bits))
return 'P';
if (S_ISWHT (bits))
return 'w';
return '?';
}
/* Like filemodestring, but rely only on MODE. */
void
strmode (mode_t mode, char *str)
{
str[0] = ftypelet (mode);
str[1] = mode & S_IRUSR ? 'r' : '-';
str[2] = mode & S_IWUSR ? 'w' : '-';
str[3] = (mode & S_ISUID
? (mode & S_IXUSR ? 's' : 'S')
: (mode & S_IXUSR ? 'x' : '-'));
str[4] = mode & S_IRGRP ? 'r' : '-';
str[5] = mode & S_IWGRP ? 'w' : '-';
str[6] = (mode & S_ISGID
? (mode & S_IXGRP ? 's' : 'S')
: (mode & S_IXGRP ? 'x' : '-'));
str[7] = mode & S_IROTH ? 'r' : '-';
str[8] = mode & S_IWOTH ? 'w' : '-';
str[9] = (mode & S_ISVTX
? (mode & S_IXOTH ? 't' : 'T')
: (mode & S_IXOTH ? 'x' : '-'));
str[10] = ' ';
str[11] = '\0';
}
#endif /* ! HAVE_DECL_STRMODE */
/* filemodestring - fill in string STR with an ls-style ASCII
representation of the st_mode field of file stats block STATP.
12 characters are stored in STR.
The characters stored in STR are:
0 File type, as in ftypelet above, except that other letters are used
for files whose type cannot be determined solely from st_mode:
'F' semaphore
'M' migrated file (Cray DMF)
'Q' message queue
'S' shared memory object
'T' typed memory object
1 'r' if the owner may read, '-' otherwise.
2 'w' if the owner may write, '-' otherwise.
3 'x' if the owner may execute, 's' if the file is
set-user-id, '-' otherwise.
'S' if the file is set-user-id, but the execute
bit isn't set.
4 'r' if group members may read, '-' otherwise.
5 'w' if group members may write, '-' otherwise.
6 'x' if group members may execute, 's' if the file is
set-group-id, '-' otherwise.
'S' if it is set-group-id but not executable.
7 'r' if any user may read, '-' otherwise.
8 'w' if any user may write, '-' otherwise.
9 'x' if any user may execute, 't' if the file is "sticky"
(will be retained in swap space after execution), '-'
otherwise.
'T' if the file is sticky but not executable.
10 ' ' for compatibility with 4.4BSD strmode,
since this interface does not support ACLs.
11 '\0'. */
void
filemodestring (struct stat const *statp, char *str)
{
strmode (statp->st_mode, str);
if (S_TYPEISSEM (statp))
str[0] = 'F';
else if (IS_MIGRATED_FILE (statp))
str[0] = 'M';
else if (S_TYPEISMQ (statp))
str[0] = 'Q';
else if (S_TYPEISSHM (statp))
str[0] = 'S';
else if (S_TYPEISTMO (statp))
str[0] = 'T';
}

44
lib/filemode.h Normal file
View file

@ -0,0 +1,44 @@
/* Make a string describing file modes.
Copyright (C) 1998-1999, 2003, 2006, 2009-2011 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef FILEMODE_H_
# include <sys/types.h>
# include <sys/stat.h>
/* Get the declaration of strmode. */
# if HAVE_DECL_STRMODE
# include <string.h> /* MacOS X, FreeBSD, OpenBSD */
# include <unistd.h> /* NetBSD */
# endif
# ifdef __cplusplus
extern "C" {
# endif
# if !HAVE_DECL_STRMODE
extern void strmode (mode_t mode, char *str);
# endif
extern void filemodestring (struct stat const *statp, char *str);
# ifdef __cplusplus
}
# endif
#endif

View file

@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime
MOSTLYCLEANFILES += core *.stackdump
@ -88,6 +88,15 @@ EXTRA_libgnu_a_SOURCES += ftoastr.c
## end gnulib module dtoastr
## begin gnulib module filemode
EXTRA_DIST += filemode.c filemode.h
EXTRA_libgnu_a_SOURCES += filemode.c
## end gnulib module filemode
## begin gnulib module getloadavg
@ -331,6 +340,65 @@ EXTRA_libgnu_a_SOURCES += strftime.c
## end gnulib module strftime
## begin gnulib module sys_stat
BUILT_SOURCES += sys/stat.h
# We need the following in order to create <sys/stat.h> when the system
# has one that is incomplete.
sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
-e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
-e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \
-e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
-e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
-e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \
-e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \
-e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \
-e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \
-e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \
-e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \
-e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \
-e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
-e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
-e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
-e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
-e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
-e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \
-e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \
-e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \
-e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
-e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
-e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
-e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
-e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
-e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
-e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
-e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
-e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
-e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
-e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
-e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/sys_stat.in.h; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
MOSTLYCLEANDIRS += sys
EXTRA_DIST += sys_stat.in.h
## end gnulib module sys_stat
## begin gnulib module time
BUILT_SOURCES += time.h

646
lib/sys_stat.in.h Normal file
View file

@ -0,0 +1,646 @@
/* Provide a more complete sys/stat header file.
Copyright (C) 2005-2011 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
/* This file is supposed to be used on platforms where <sys/stat.h> is
incomplete. It is intended to provide definitions and prototypes
needed by an application. Start with what the system provides. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#if defined __need_system_sys_stat_h
/* Special invocation convention. */
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
#else
/* Normal invocation convention. */
#ifndef _GL_SYS_STAT_H
/* Get nlink_t. */
#include <sys/types.h>
/* Get struct timespec. */
#include <time.h>
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
#ifndef _GL_SYS_STAT_H
#define _GL_SYS_STAT_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
headers that may declare mkdir(). */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# include <io.h> /* mingw32, mingw64 */
# include <direct.h> /* mingw64 */
#endif
#ifndef S_IFMT
# define S_IFMT 0170000
#endif
#if STAT_MACROS_BROKEN
# undef S_ISBLK
# undef S_ISCHR
# undef S_ISDIR
# undef S_ISFIFO
# undef S_ISLNK
# undef S_ISNAM
# undef S_ISMPB
# undef S_ISMPC
# undef S_ISNWK
# undef S_ISREG
# undef S_ISSOCK
#endif
#ifndef S_ISBLK
# ifdef S_IFBLK
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(m) 0
# endif
#endif
#ifndef S_ISCHR
# ifdef S_IFCHR
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
# else
# define S_ISCHR(m) 0
# endif
#endif
#ifndef S_ISDIR
# ifdef S_IFDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# else
# define S_ISDIR(m) 0
# endif
#endif
#ifndef S_ISDOOR /* Solaris 2.5 and up */
# define S_ISDOOR(m) 0
#endif
#ifndef S_ISFIFO
# ifdef S_IFIFO
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(m) 0
# endif
#endif
#ifndef S_ISLNK
# ifdef S_IFLNK
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
# else
# define S_ISLNK(m) 0
# endif
#endif
#ifndef S_ISMPB /* V7 */
# ifdef S_IFMPB
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
# else
# define S_ISMPB(m) 0
# define S_ISMPC(m) 0
# endif
#endif
#ifndef S_ISNAM /* Xenix */
# ifdef S_IFNAM
# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
# else
# define S_ISNAM(m) 0
# endif
#endif
#ifndef S_ISNWK /* HP/UX */
# ifdef S_IFNWK
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
# else
# define S_ISNWK(m) 0
# endif
#endif
#ifndef S_ISPORT /* Solaris 10 and up */
# define S_ISPORT(m) 0
#endif
#ifndef S_ISREG
# ifdef S_IFREG
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# else
# define S_ISREG(m) 0
# endif
#endif
#ifndef S_ISSOCK
# ifdef S_IFSOCK
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(m) 0
# endif
#endif
#ifndef S_TYPEISMQ
# define S_TYPEISMQ(p) 0
#endif
#ifndef S_TYPEISTMO
# define S_TYPEISTMO(p) 0
#endif
#ifndef S_TYPEISSEM
# ifdef S_INSEM
# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
# else
# define S_TYPEISSEM(p) 0
# endif
#endif
#ifndef S_TYPEISSHM
# ifdef S_INSHD
# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
# else
# define S_TYPEISSHM(p) 0
# endif
#endif
/* high performance ("contiguous data") */
#ifndef S_ISCTG
# define S_ISCTG(p) 0
#endif
/* Cray DMF (data migration facility): off line, with data */
#ifndef S_ISOFD
# define S_ISOFD(p) 0
#endif
/* Cray DMF (data migration facility): off line, with no data */
#ifndef S_ISOFL
# define S_ISOFL(p) 0
#endif
/* 4.4BSD whiteout */
#ifndef S_ISWHT
# define S_ISWHT(m) 0
#endif
/* If any of the following are undefined,
define them to their de facto standard values. */
#if !S_ISUID
# define S_ISUID 04000
#endif
#if !S_ISGID
# define S_ISGID 02000
#endif
/* S_ISVTX is a common extension to POSIX. */
#ifndef S_ISVTX
# define S_ISVTX 01000
#endif
#if !S_IRUSR && S_IREAD
# define S_IRUSR S_IREAD
#endif
#if !S_IRUSR
# define S_IRUSR 00400
#endif
#if !S_IRGRP
# define S_IRGRP (S_IRUSR >> 3)
#endif
#if !S_IROTH
# define S_IROTH (S_IRUSR >> 6)
#endif
#if !S_IWUSR && S_IWRITE
# define S_IWUSR S_IWRITE
#endif
#if !S_IWUSR
# define S_IWUSR 00200
#endif
#if !S_IWGRP
# define S_IWGRP (S_IWUSR >> 3)
#endif
#if !S_IWOTH
# define S_IWOTH (S_IWUSR >> 6)
#endif
#if !S_IXUSR && S_IEXEC
# define S_IXUSR S_IEXEC
#endif
#if !S_IXUSR
# define S_IXUSR 00100
#endif
#if !S_IXGRP
# define S_IXGRP (S_IXUSR >> 3)
#endif
#if !S_IXOTH
# define S_IXOTH (S_IXUSR >> 6)
#endif
#if !S_IRWXU
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
#endif
#if !S_IRWXG
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
#endif
#if !S_IRWXO
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
#endif
/* S_IXUGO is a common extension to POSIX. */
#if !S_IXUGO
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#endif
#ifndef S_IRWXUGO
# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
#endif
/* Macros for futimens and utimensat. */
#ifndef UTIME_NOW
# define UTIME_NOW (-1)
# define UTIME_OMIT (-2)
#endif
#if @GNULIB_FCHMODAT@
# if !@HAVE_FCHMODAT@
_GL_FUNCDECL_SYS (fchmodat, int,
(int fd, char const *file, mode_t mode, int flag)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (fchmodat, int,
(int fd, char const *file, mode_t mode, int flag));
_GL_CXXALIASWARN (fchmodat);
#elif defined GNULIB_POSIXCHECK
# undef fchmodat
# if HAVE_RAW_DECL_FCHMODAT
_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
"use gnulib module openat for portability");
# endif
#endif
#if @REPLACE_FSTAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define fstat rpl_fstat
# endif
_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
#else
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
#endif
_GL_CXXALIASWARN (fstat);
#if @GNULIB_FSTATAT@
# if @REPLACE_FSTATAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fstatat
# define fstatat rpl_fstatat
# endif
_GL_FUNCDECL_RPL (fstatat, int,
(int fd, char const *name, struct stat *st, int flags)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (fstatat, int,
(int fd, char const *name, struct stat *st, int flags));
# else
# if !@HAVE_FSTATAT@
_GL_FUNCDECL_SYS (fstatat, int,
(int fd, char const *name, struct stat *st, int flags)
_GL_ARG_NONNULL ((2, 3)));
# endif
_GL_CXXALIAS_SYS (fstatat, int,
(int fd, char const *name, struct stat *st, int flags));
# endif
_GL_CXXALIASWARN (fstatat);
#elif defined GNULIB_POSIXCHECK
# undef fstatat
# if HAVE_RAW_DECL_FSTATAT
_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
"use gnulib module openat for portability");
# endif
#endif
#if @GNULIB_FUTIMENS@
# if @REPLACE_FUTIMENS@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef futimens
# define futimens rpl_futimens
# endif
_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
# else
# if !@HAVE_FUTIMENS@
_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
# endif
_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
# endif
_GL_CXXALIASWARN (futimens);
#elif defined GNULIB_POSIXCHECK
# undef futimens
# if HAVE_RAW_DECL_FUTIMENS
_GL_WARN_ON_USE (futimens, "futimens is not portable - "
"use gnulib module futimens for portability");
# endif
#endif
#if @GNULIB_LCHMOD@
/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
denotes a symbolic link. */
# if !@HAVE_LCHMOD@
/* The lchmod replacement follows symbolic links. Callers should take
this into account; lchmod should be applied only to arguments that
are known to not be symbolic links. On hosts that lack lchmod,
this can lead to race conditions between the check and the
invocation of lchmod, but we know of no workarounds that are
reliable in general. You might try requesting support for lchmod
from your operating system supplier. */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define lchmod chmod
# endif
/* Need to cast, because on mingw, the second parameter of chmod is
int mode. */
_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
(const char *filename, mode_t mode));
# else
# if 0 /* assume already declared */
_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
# endif
# if @HAVE_LCHMOD@
_GL_CXXALIASWARN (lchmod);
# endif
#elif defined GNULIB_POSIXCHECK
# undef lchmod
# if HAVE_RAW_DECL_LCHMOD
_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
"use gnulib module lchmod for portability");
# endif
#endif
#if @GNULIB_LSTAT@
# if ! @HAVE_LSTAT@
/* mingw does not support symlinks, therefore it does not have lstat. But
without links, stat does just fine. */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define lstat stat
# endif
_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
# elif @REPLACE_LSTAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef lstat
# define lstat rpl_lstat
# endif
_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
# else
_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
# endif
# if @HAVE_LSTAT@
_GL_CXXALIASWARN (lstat);
# endif
#elif defined GNULIB_POSIXCHECK
# undef lstat
# if HAVE_RAW_DECL_LSTAT
_GL_WARN_ON_USE (lstat, "lstat is unportable - "
"use gnulib module lstat for portability");
# endif
#endif
#if @REPLACE_MKDIR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef mkdir
# define mkdir rpl_mkdir
# endif
_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
#else
/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
Additionally, it declares _mkdir (and depending on compile flags, an
alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
which are included above. */
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if !GNULIB_defined_rpl_mkdir
static inline int
rpl_mkdir (char const *name, mode_t mode)
{
return _mkdir (name);
}
# define GNULIB_defined_rpl_mkdir 1
# endif
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mkdir rpl_mkdir
# endif
_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
# else
_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
# endif
#endif
_GL_CXXALIASWARN (mkdir);
#if @GNULIB_MKDIRAT@
# if !@HAVE_MKDIRAT@
_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
_GL_CXXALIASWARN (mkdirat);
#elif defined GNULIB_POSIXCHECK
# undef mkdirat
# if HAVE_RAW_DECL_MKDIRAT
_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
"use gnulib module openat for portability");
# endif
#endif
#if @GNULIB_MKFIFO@
# if @REPLACE_MKFIFO@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef mkfifo
# define mkfifo rpl_mkfifo
# endif
_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
# else
# if !@HAVE_MKFIFO@
_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
# endif
_GL_CXXALIASWARN (mkfifo);
#elif defined GNULIB_POSIXCHECK
# undef mkfifo
# if HAVE_RAW_DECL_MKFIFO
_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
"use gnulib module mkfifo for portability");
# endif
#endif
#if @GNULIB_MKFIFOAT@
# if !@HAVE_MKFIFOAT@
_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
_GL_CXXALIASWARN (mkfifoat);
#elif defined GNULIB_POSIXCHECK
# undef mkfifoat
# if HAVE_RAW_DECL_MKFIFOAT
_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
"use gnulib module mkfifoat for portability");
# endif
#endif
#if @GNULIB_MKNOD@
# if @REPLACE_MKNOD@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef mknod
# define mknod rpl_mknod
# endif
_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
# else
# if !@HAVE_MKNOD@
_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
_GL_ARG_NONNULL ((1)));
# endif
/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
# endif
_GL_CXXALIASWARN (mknod);
#elif defined GNULIB_POSIXCHECK
# undef mknod
# if HAVE_RAW_DECL_MKNOD
_GL_WARN_ON_USE (mknod, "mknod is not portable - "
"use gnulib module mknod for portability");
# endif
#endif
#if @GNULIB_MKNODAT@
# if !@HAVE_MKNODAT@
_GL_FUNCDECL_SYS (mknodat, int,
(int fd, char const *file, mode_t mode, dev_t dev)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mknodat, int,
(int fd, char const *file, mode_t mode, dev_t dev));
_GL_CXXALIASWARN (mknodat);
#elif defined GNULIB_POSIXCHECK
# undef mknodat
# if HAVE_RAW_DECL_MKNODAT
_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
"use gnulib module mkfifoat for portability");
# endif
#endif
#if @GNULIB_STAT@
# if @REPLACE_STAT@
/* We can't use the object-like #define stat rpl_stat, because of
struct stat. This means that rpl_stat will not be used if the user
does (stat)(a,b). Oh well. */
# undef stat
# ifdef _LARGE_FILES
/* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
so we have to replace stat64() instead of stat(). */
# define stat stat64
# undef stat64
# define stat64(name, st) rpl_stat (name, st)
# else /* !_LARGE_FILES */
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
_GL_EXTERN_C int stat (const char *name, struct stat *buf)
_GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef stat
# if HAVE_RAW_DECL_STAT
_GL_WARN_ON_USE (stat, "stat is unportable - "
"use gnulib module stat for portability");
# endif
#endif
#if @GNULIB_UTIMENSAT@
# if @REPLACE_UTIMENSAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef utimensat
# define utimensat rpl_utimensat
# endif
_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
struct timespec const times[2], int flag)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
struct timespec const times[2], int flag));
# else
# if !@HAVE_UTIMENSAT@
_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
struct timespec const times[2], int flag)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
struct timespec const times[2], int flag));
# endif
_GL_CXXALIASWARN (utimensat);
#elif defined GNULIB_POSIXCHECK
# undef utimensat
# if HAVE_RAW_DECL_UTIMENSAT
_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
"use gnulib module utimensat for portability");
# endif
#endif
#endif /* _GL_SYS_STAT_H */
#endif /* _GL_SYS_STAT_H */
#endif

View file

@ -55,7 +55,7 @@ Each entry has the form (FUNCTION . FUNCTIONS-IT-CALLS).")
"term.c" "cm.c" "emacs.c" "keyboard.c" "macros.c"
"keymap.c" "sysdep.c" "buffer.c" "filelock.c"
"insdel.c" "marker.c" "minibuf.c" "fileio.c"
"dired.c" "filemode.c" "cmds.c" "casefiddle.c"
"dired.c" "cmds.c" "casefiddle.c"
"indent.c" "search.c" "regex.c" "undo.c"
"alloc.c" "data.c" "doc.c" "editfns.c"
"callint.c" "eval.c" "fns.c" "print.c" "lread.c"

12
m4/filemode.m4 Normal file
View file

@ -0,0 +1,12 @@
# filemode.m4 serial 7
dnl Copyright (C) 2002, 2005-2006, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FILEMODE],
[
AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
AC_LIBOBJ([filemode])
AC_CHECK_DECLS_ONCE([strmode])
])

View file

@ -32,6 +32,7 @@ AC_DEFUN([gl_EARLY],
# Code from module dtoastr:
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
# Code from module filemode:
# Code from module getloadavg:
# Code from module getopt-gnu:
# Code from module getopt-posix:
@ -46,6 +47,7 @@ AC_DEFUN([gl_EARLY],
# Code from module stdint:
# Code from module stdlib:
# Code from module strftime:
# Code from module sys_stat:
# Code from module time:
# Code from module time_r:
# Code from module unistd:
@ -75,6 +77,8 @@ AC_DEFUN([gl_INIT],
# Code from module dtoastr:
AC_REQUIRE([gl_C99_STRTOLD])
# Code from module extensions:
# Code from module filemode:
gl_FILEMODE
# Code from module getloadavg:
gl_GETLOADAVG([$gl_source_base])
gl_STDLIB_MODULE_INDICATOR([getloadavg])
@ -105,6 +109,9 @@ AC_DEFUN([gl_INIT],
gl_STDLIB_H
# Code from module strftime:
gl_FUNC_GNU_STRFTIME
# Code from module sys_stat:
gl_HEADER_SYS_STAT_H
AC_PROG_MKDIR_P
# Code from module time:
gl_HEADER_TIME_H
# Code from module time_r:
@ -257,6 +264,8 @@ AC_DEFUN([gl_FILE_LIST], [
build-aux/c++defs.h
build-aux/warn-on-use.h
lib/dtoastr.c
lib/filemode.c
lib/filemode.h
lib/ftoastr.c
lib/ftoastr.h
lib/getloadavg.c
@ -277,12 +286,14 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stdlib.in.h
lib/strftime.c
lib/strftime.h
lib/sys_stat.in.h
lib/time.in.h
lib/time_r.c
lib/unistd.in.h
m4/00gnulib.m4
m4/c-strtod.m4
m4/extensions.m4
m4/filemode.m4
m4/getloadavg.m4
m4/getopt.m4
m4/gnulib-common.m4
@ -291,11 +302,13 @@ AC_DEFUN([gl_FILE_LIST], [
m4/md5.m4
m4/mktime.m4
m4/multiarch.m4
m4/st_dm_mode.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/stdint.m4
m4/stdlib_h.m4
m4/strftime.m4
m4/sys_stat_h.m4
m4/time_h.m4
m4/time_r.m4
m4/tm_gmtoff.m4

23
m4/st_dm_mode.m4 Normal file
View file

@ -0,0 +1,23 @@
# serial 6
# Copyright (C) 1998-1999, 2001, 2009-2011 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
AC_DEFUN([AC_STRUCT_ST_DM_MODE],
[AC_CACHE_CHECK([for st_dm_mode in struct stat], [ac_cv_struct_st_dm_mode],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/stat.h>]], [[struct stat s; s.st_dm_mode;]])],
[ac_cv_struct_st_dm_mode=yes],
[ac_cv_struct_st_dm_mode=no])])
if test $ac_cv_struct_st_dm_mode = yes; then
AC_DEFINE([HAVE_ST_DM_MODE], [1],
[Define if struct stat has an st_dm_mode member. ])
fi
]
)

82
m4/sys_stat_h.m4 Normal file
View file

@ -0,0 +1,82 @@
# sys_stat_h.m4 serial 24 -*- Autoconf -*-
dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Eric Blake.
dnl Provide a GNU-like <sys/stat.h>.
AC_DEFUN([gl_HEADER_SYS_STAT_H],
[
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
dnl For the mkdir substitute.
AC_REQUIRE([AC_C_INLINE])
dnl Check for broken stat macros.
AC_REQUIRE([AC_HEADER_STAT])
gl_CHECK_NEXT_HEADERS([sys/stat.h])
dnl Define types that are supposed to be defined in <sys/types.h> or
dnl <sys/stat.h>.
AC_CHECK_TYPE([nlink_t], [],
[AC_DEFINE([nlink_t], [int],
[Define to the type of st_nlink in struct stat, or a supertype.])],
[#include <sys/types.h>
#include <sys/stat.h>])
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
mknod mknodat stat utimensat])
]) # gl_HEADER_SYS_STAT_H
AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])
])

View file

@ -1,3 +1,13 @@
2011-02-21 Paul Eggert <eggert@cs.ucla.edu>
Import filemode module from gnulib.
* Makefile.in (base_obj): Remove filemode.o, as it's now in ../lib.
* deps.mk (dired.o): Depend on ../lib/filemode.h, too.
(filemode.o): Remove; this is now in ../lib.
* dired.c: Include <filemode.h>.
(filemodestring): Remove now-redundant decl.
* config.in: Regenerate.
2011-02-20 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in ($(BLD)/fns.$(O)): Depend on

View file

@ -347,7 +347,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
emacs.o keyboard.o macros.o keymap.o sysdep.o \
buffer.o filelock.o insdel.o marker.o \
minibuf.o fileio.o dired.o filemode.o \
minibuf.o fileio.o dired.o \
cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
alloc.o data.o doc.o editfns.o callint.o \
eval.o floatfns.o fns.o font.o print.o lread.o \

View file

@ -152,6 +152,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
don't. */
#undef HAVE_DECL_LOCALTIME_R
/* Define to 1 if you have the declaration of `strmode', and to 0 if you
don't. */
#undef HAVE_DECL_STRMODE
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
don't. */
#undef HAVE_DECL_SYS_SIGLIST
@ -686,6 +690,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */
#undef HAVE_STRUCT_UTIMBUF
/* Define if struct stat has an st_dm_mode member. */
#undef HAVE_ST_DM_MODE
/* Define to 1 if you have the `sync' function. */
#undef HAVE_SYNC
@ -981,6 +988,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
@ -1149,6 +1159,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to the name of the strftime replacement function. */
#undef my_strftime
/* Define to the type of st_nlink in struct stat, or a supertype. */
#undef nlink_t
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t

View file

@ -73,7 +73,7 @@ pre-crt0.o: pre-crt0.c
dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h)
dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
coding.h regex.h systime.h blockinput.h atimer.h composite.h \
../lib/unistd.h globals.h
../lib/filemode.h ../lib/unistd.h globals.h
dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
disptab.h indent.h $(INTERVALS_H) nsgui.h ../lib/unistd.h \
@ -98,7 +98,6 @@ fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
commands.h globals.h ../lib/unistd.h
filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
../lib/unistd.h lisp.h globals.h $(config_h)
filemode.o: filemode.c $(config_h)
font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
font.h lisp.h globals.h $(config_h) buffer.h composite.h fontset.h \
xterm.h nsgui.h msdos.h

View file

@ -61,6 +61,8 @@ extern struct direct *readdir (DIR *);
#endif /* HAVE_DIRENT_H */
#include <filemode.h>
#ifdef MSDOS
#define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
#else
@ -82,9 +84,6 @@ extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
struct re_registers *,
Lisp_Object, int, int);
/* From filemode.c. Can't go in Lisp.h because of `stat'. */
extern void filemodestring (struct stat *, char *);
/* if system does not have symbolic links, it does not have lstat.
In that case, use ordinary stat instead. */

View file

@ -1,245 +0,0 @@
/* filemode.c -- make a string describing file modes
Copyright (C) 1985, 1990, 1993, 2001-2011 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#if !S_IRUSR
# if S_IREAD
# define S_IRUSR S_IREAD
# else
# define S_IRUSR 00400
# endif
#endif
#if !S_IWUSR
# if S_IWRITE
# define S_IWUSR S_IWRITE
# else
# define S_IWUSR 00200
# endif
#endif
#if !S_IXUSR
# if S_IEXEC
# define S_IXUSR S_IEXEC
# else
# define S_IXUSR 00100
# endif
#endif
#ifdef STAT_MACROS_BROKEN
#undef S_ISBLK
#undef S_ISCHR
#undef S_ISDIR
#undef S_ISFIFO
#undef S_ISLNK
#undef S_ISMPB
#undef S_ISMPC
#undef S_ISNWK
#undef S_ISREG
#undef S_ISSOCK
#endif /* STAT_MACROS_BROKEN. */
#if !defined(S_ISBLK) && defined(S_IFBLK)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#endif
#if !defined(S_ISCHR) && defined(S_IFCHR)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
#if !defined(S_ISDIR) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISREG) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISFIFO) && defined(S_IFIFO)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#endif
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#endif
#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
#endif
#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
void mode_string (short unsigned int mode, char *str);
static char ftypelet (long int bits);
static void rwx (short unsigned int bits, char *chars);
static void setst (short unsigned int bits, char *chars);
/* filemodestring - fill in string STR with an ls-style ASCII
representation of the st_mode field of file stats block STATP.
10 characters are stored in STR; no terminating null is added.
The characters stored in STR are:
0 File type. 'd' for directory, 'c' for character
special, 'b' for block special, 'm' for multiplex,
'l' for symbolic link, 's' for socket, 'p' for fifo,
'-' for regular, '?' for any other file type
1 'r' if the owner may read, '-' otherwise.
2 'w' if the owner may write, '-' otherwise.
3 'x' if the owner may execute, 's' if the file is
set-user-id, '-' otherwise.
'S' if the file is set-user-id, but the execute
bit isn't set.
4 'r' if group members may read, '-' otherwise.
5 'w' if group members may write, '-' otherwise.
6 'x' if group members may execute, 's' if the file is
set-group-id, '-' otherwise.
'S' if it is set-group-id but not executable.
7 'r' if any user may read, '-' otherwise.
8 'w' if any user may write, '-' otherwise.
9 'x' if any user may execute, 't' if the file is "sticky"
(will be retained in swap space after execution), '-'
otherwise.
'T' if the file is sticky but not executable. */
void
filemodestring (struct stat *statp, char *str)
{
mode_string (statp->st_mode, str);
}
/* Like filemodestring, but only the relevant part of the `struct stat'
is given as an argument. */
void
mode_string (short unsigned int mode, char *str)
{
str[0] = ftypelet ((long) mode);
rwx ((mode & 0700) << 0, &str[1]);
rwx ((mode & 0070) << 3, &str[4]);
rwx ((mode & 0007) << 6, &str[7]);
setst (mode, str);
}
/* Return a character indicating the type of file described by
file mode BITS:
'd' for directories
'b' for block special files
'c' for character special files
'm' for multiplexor files
'l' for symbolic links
's' for sockets
'p' for fifos
'-' for regular files
'?' for any other file type. */
static char
ftypelet (long int bits)
{
#ifdef S_ISBLK
if (S_ISBLK (bits))
return 'b';
#endif
if (S_ISCHR (bits))
return 'c';
if (S_ISDIR (bits))
return 'd';
if (S_ISREG (bits))
return '-';
#ifdef S_ISFIFO
if (S_ISFIFO (bits))
return 'p';
#endif
#ifdef S_ISLNK
if (S_ISLNK (bits))
return 'l';
#endif
#ifdef S_ISSOCK
if (S_ISSOCK (bits))
return 's';
#endif
#ifdef S_ISMPC
if (S_ISMPC (bits))
return 'm';
#endif
#ifdef S_ISNWK
if (S_ISNWK (bits))
return 'n';
#endif
return '?';
}
/* Look at read, write, and execute bits in BITS and set
flags in CHARS accordingly. */
static void
rwx (short unsigned int bits, char *chars)
{
chars[0] = (bits & S_IRUSR) ? 'r' : '-';
chars[1] = (bits & S_IWUSR) ? 'w' : '-';
chars[2] = (bits & S_IXUSR) ? 'x' : '-';
}
/* Set the 's' and 't' flags in file attributes string CHARS,
according to the file mode BITS. */
static void
setst (short unsigned int bits, char *chars)
{
#ifdef S_ISUID
if (bits & S_ISUID)
{
if (chars[3] != 'x')
/* Set-uid, but not executable by owner. */
chars[3] = 'S';
else
chars[3] = 's';
}
#endif
#ifdef S_ISGID
if (bits & S_ISGID)
{
if (chars[6] != 'x')
/* Set-gid, but not executable by group. */
chars[6] = 'S';
else
chars[6] = 's';
}
#endif
#ifdef S_ISVTX
if (bits & S_ISVTX)
{
if (chars[9] != 'x')
/* Sticky, but not executable by others. */
chars[9] = 'T';
else
chars[9] = 't';
}
#endif
}