diff options
| author | Paul Eggert | 2011-02-20 02:51:50 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-20 02:51:50 -0800 |
| commit | 5fa4ac767c6aaf9203d2ec6ff2f90a061b401930 (patch) | |
| tree | c433fefa9db8edd699775cbd61cf21bc2883cd10 | |
| parent | 61353ac8cdbdda53d75f5ab9aa7f0b637aee5a00 (diff) | |
| download | emacs-5fa4ac767c6aaf9203d2ec6ff2f90a061b401930.tar.gz emacs-5fa4ac767c6aaf9203d2ec6ff2f90a061b401930.zip | |
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 Paul Eggert <eggert@cs.ucla.edu>
| -rw-r--r-- | ChangeLog | 15 | ||||
| -rw-r--r-- | Makefile.in | 3 | ||||
| -rw-r--r-- | aclocal.m4 | 3 | ||||
| -rwxr-xr-x | configure | 260 | ||||
| -rw-r--r-- | lib/Makefile.am | 1 | ||||
| -rw-r--r-- | lib/Makefile.in | 120 | ||||
| -rw-r--r-- | lib/filemode.c | 180 | ||||
| -rw-r--r-- | lib/filemode.h | 44 | ||||
| -rw-r--r-- | lib/gnulib.mk | 70 | ||||
| -rw-r--r-- | lib/sys_stat.in.h | 646 | ||||
| -rw-r--r-- | lisp/emacs-lisp/find-gc.el | 2 | ||||
| -rw-r--r-- | m4/filemode.m4 | 12 | ||||
| -rw-r--r-- | m4/gl-comp.m4 | 13 | ||||
| -rw-r--r-- | m4/st_dm_mode.m4 | 23 | ||||
| -rw-r--r-- | m4/sys_stat_h.m4 | 82 | ||||
| -rw-r--r-- | src/filemode.c | 245 |
16 files changed, 1455 insertions, 264 deletions
| @@ -1,5 +1,20 @@ | |||
| 1 | 2011-02-20 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-02-20 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Import filemode module from gnulib. | ||
| 4 | * .bzrignore: Add lib/sys/. | ||
| 5 | * Makefile.in (GNULIB_MODULES): Add filemode. | ||
| 6 | * lib/Makefile.am (MOSTLYCLEANDIRS): New macro. | ||
| 7 | * lib/filemode.c: Renamed from src/filemode.c and regenerated | ||
| 8 | from gnulib. This adds support for some more file types, e.g., | ||
| 9 | Cray DMF migrated files. | ||
| 10 | * lisp/emacs-lisp/find-gc.el (find-gc-source-files): Remove filemode.c. | ||
| 11 | * lib/filemode.h, lib/sys_stat.in.h, m4/filemode.m4, m4/st_dm_mode.m4: | ||
| 12 | * m4/sys_stat_h.m4: New files, generated from gnulib. | ||
| 13 | * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4: | ||
| 14 | Regenerate. | ||
| 15 | |||
| 16 | 2011-02-20 Paul Eggert <eggert@cs.ucla.edu> | ||
| 17 | |||
| 3 | Import crypto/md5 and stdint modules from gnulib. | 18 | Import crypto/md5 and stdint modules from gnulib. |
| 4 | * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4: | 19 | * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4: |
| 5 | Regenerate. | 20 | Regenerate. |
diff --git a/Makefile.in b/Makefile.in index 8e1eb1e3b1a..b1861241882 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -331,7 +331,8 @@ DOS_gnulib_comp.m4 = gl-comp.m4 | |||
| 331 | # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools | 331 | # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools |
| 332 | # as per $(gnulib_srcdir)/DEPENDENCIES. | 332 | # as per $(gnulib_srcdir)/DEPENDENCIES. |
| 333 | GNULIB_MODULES = \ | 333 | GNULIB_MODULES = \ |
| 334 | crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime | 334 | crypto/md5 dtoastr filemode getloadavg getopt-gnu \ |
| 335 | ignore-value mktime strftime | ||
| 335 | GNULIB_TOOL_FLAGS = \ | 336 | GNULIB_TOOL_FLAGS = \ |
| 336 | --import --no-changelog --no-vc-files --makefile-name=gnulib.mk | 337 | --import --no-changelog --no-vc-files --makefile-name=gnulib.mk |
| 337 | sync-from-gnulib: $(gnulib_srcdir) | 338 | sync-from-gnulib: $(gnulib_srcdir) |
diff --git a/aclocal.m4 b/aclocal.m4 index 2468e83d25a..880166dc34e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 | |||
| @@ -987,6 +987,7 @@ AC_SUBST([am__untar]) | |||
| 987 | m4_include([m4/00gnulib.m4]) | 987 | m4_include([m4/00gnulib.m4]) |
| 988 | m4_include([m4/c-strtod.m4]) | 988 | m4_include([m4/c-strtod.m4]) |
| 989 | m4_include([m4/extensions.m4]) | 989 | m4_include([m4/extensions.m4]) |
| 990 | m4_include([m4/filemode.m4]) | ||
| 990 | m4_include([m4/getloadavg.m4]) | 991 | m4_include([m4/getloadavg.m4]) |
| 991 | m4_include([m4/getopt.m4]) | 992 | m4_include([m4/getopt.m4]) |
| 992 | m4_include([m4/gl-comp.m4]) | 993 | m4_include([m4/gl-comp.m4]) |
| @@ -996,11 +997,13 @@ m4_include([m4/longlong.m4]) | |||
| 996 | m4_include([m4/md5.m4]) | 997 | m4_include([m4/md5.m4]) |
| 997 | m4_include([m4/mktime.m4]) | 998 | m4_include([m4/mktime.m4]) |
| 998 | m4_include([m4/multiarch.m4]) | 999 | m4_include([m4/multiarch.m4]) |
| 1000 | m4_include([m4/st_dm_mode.m4]) | ||
| 999 | m4_include([m4/stdbool.m4]) | 1001 | m4_include([m4/stdbool.m4]) |
| 1000 | m4_include([m4/stddef_h.m4]) | 1002 | m4_include([m4/stddef_h.m4]) |
| 1001 | m4_include([m4/stdint.m4]) | 1003 | m4_include([m4/stdint.m4]) |
| 1002 | m4_include([m4/stdlib_h.m4]) | 1004 | m4_include([m4/stdlib_h.m4]) |
| 1003 | m4_include([m4/strftime.m4]) | 1005 | m4_include([m4/strftime.m4]) |
| 1006 | m4_include([m4/sys_stat_h.m4]) | ||
| 1004 | m4_include([m4/time_h.m4]) | 1007 | m4_include([m4/time_h.m4]) |
| 1005 | m4_include([m4/time_r.m4]) | 1008 | m4_include([m4/time_r.m4]) |
| 1006 | m4_include([m4/tm_gmtoff.m4]) | 1009 | m4_include([m4/tm_gmtoff.m4]) |
| @@ -677,6 +677,40 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC | |||
| 677 | TIME_H_DEFINES_STRUCT_TIMESPEC | 677 | TIME_H_DEFINES_STRUCT_TIMESPEC |
| 678 | NEXT_AS_FIRST_DIRECTIVE_TIME_H | 678 | NEXT_AS_FIRST_DIRECTIVE_TIME_H |
| 679 | NEXT_TIME_H | 679 | NEXT_TIME_H |
| 680 | NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H | ||
| 681 | NEXT_SYS_STAT_H | ||
| 682 | REPLACE_UTIMENSAT | ||
| 683 | REPLACE_STAT | ||
| 684 | REPLACE_MKNOD | ||
| 685 | REPLACE_MKFIFO | ||
| 686 | REPLACE_MKDIR | ||
| 687 | REPLACE_LSTAT | ||
| 688 | REPLACE_FUTIMENS | ||
| 689 | REPLACE_FSTATAT | ||
| 690 | REPLACE_FSTAT | ||
| 691 | HAVE_UTIMENSAT | ||
| 692 | HAVE_MKNODAT | ||
| 693 | HAVE_MKNOD | ||
| 694 | HAVE_MKFIFOAT | ||
| 695 | HAVE_MKFIFO | ||
| 696 | HAVE_MKDIRAT | ||
| 697 | HAVE_LSTAT | ||
| 698 | HAVE_LCHMOD | ||
| 699 | HAVE_FUTIMENS | ||
| 700 | HAVE_FSTATAT | ||
| 701 | HAVE_FCHMODAT | ||
| 702 | GNULIB_UTIMENSAT | ||
| 703 | GNULIB_STAT | ||
| 704 | GNULIB_MKNODAT | ||
| 705 | GNULIB_MKNOD | ||
| 706 | GNULIB_MKFIFOAT | ||
| 707 | GNULIB_MKFIFO | ||
| 708 | GNULIB_MKDIRAT | ||
| 709 | GNULIB_LSTAT | ||
| 710 | GNULIB_LCHMOD | ||
| 711 | GNULIB_FUTIMENS | ||
| 712 | GNULIB_FSTATAT | ||
| 713 | GNULIB_FCHMODAT | ||
| 680 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H | 714 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H |
| 681 | NEXT_STDLIB_H | 715 | NEXT_STDLIB_H |
| 682 | STDINT_H | 716 | STDINT_H |
| @@ -2926,6 +2960,7 @@ as_fn_append ac_func_list " alarm" | |||
| 2926 | as_fn_append ac_header_list " wchar.h" | 2960 | as_fn_append ac_header_list " wchar.h" |
| 2927 | as_fn_append ac_header_list " stdint.h" | 2961 | as_fn_append ac_header_list " stdint.h" |
| 2928 | as_fn_append ac_func_list " tzset" | 2962 | as_fn_append ac_func_list " tzset" |
| 2963 | as_fn_append ac_header_list " sys/stat.h" | ||
| 2929 | as_fn_append ac_header_list " sys/time.h" | 2964 | as_fn_append ac_header_list " sys/time.h" |
| 2930 | as_fn_append ac_func_list " localtime_r" | 2965 | as_fn_append ac_func_list " localtime_r" |
| 2931 | # Check that the precious variables saved in the cache have kept the same | 2966 | # 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; } | |||
| 6089 | # Code from module dtoastr: | 6124 | # Code from module dtoastr: |
| 6090 | # Code from module extensions: | 6125 | # Code from module extensions: |
| 6091 | 6126 | ||
| 6127 | # Code from module filemode: | ||
| 6092 | # Code from module getloadavg: | 6128 | # Code from module getloadavg: |
| 6093 | # Code from module getopt-gnu: | 6129 | # Code from module getopt-gnu: |
| 6094 | # Code from module getopt-posix: | 6130 | # Code from module getopt-posix: |
| @@ -6103,6 +6139,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } | |||
| 6103 | # Code from module stdint: | 6139 | # Code from module stdint: |
| 6104 | # Code from module stdlib: | 6140 | # Code from module stdlib: |
| 6105 | # Code from module strftime: | 6141 | # Code from module strftime: |
| 6142 | # Code from module sys_stat: | ||
| 6106 | # Code from module time: | 6143 | # Code from module time: |
| 6107 | # Code from module time_r: | 6144 | # Code from module time_r: |
| 6108 | # Code from module unistd: | 6145 | # Code from module unistd: |
| @@ -13718,6 +13755,52 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h | |||
| 13718 | 13755 | ||
| 13719 | fi | 13756 | fi |
| 13720 | 13757 | ||
| 13758 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_dm_mode in struct stat" >&5 | ||
| 13759 | $as_echo_n "checking for st_dm_mode in struct stat... " >&6; } | ||
| 13760 | if ${ac_cv_struct_st_dm_mode+:} false; then : | ||
| 13761 | $as_echo_n "(cached) " >&6 | ||
| 13762 | else | ||
| 13763 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 13764 | /* end confdefs.h. */ | ||
| 13765 | |||
| 13766 | #include <sys/types.h> | ||
| 13767 | #include <sys/stat.h> | ||
| 13768 | int | ||
| 13769 | main () | ||
| 13770 | { | ||
| 13771 | struct stat s; s.st_dm_mode; | ||
| 13772 | ; | ||
| 13773 | return 0; | ||
| 13774 | } | ||
| 13775 | _ACEOF | ||
| 13776 | if ac_fn_c_try_compile "$LINENO"; then : | ||
| 13777 | ac_cv_struct_st_dm_mode=yes | ||
| 13778 | else | ||
| 13779 | ac_cv_struct_st_dm_mode=no | ||
| 13780 | fi | ||
| 13781 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
| 13782 | fi | ||
| 13783 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_st_dm_mode" >&5 | ||
| 13784 | $as_echo "$ac_cv_struct_st_dm_mode" >&6; } | ||
| 13785 | |||
| 13786 | if test $ac_cv_struct_st_dm_mode = yes; then | ||
| 13787 | |||
| 13788 | $as_echo "#define HAVE_ST_DM_MODE 1" >>confdefs.h | ||
| 13789 | |||
| 13790 | fi | ||
| 13791 | |||
| 13792 | |||
| 13793 | ac_fn_c_check_decl "$LINENO" "strmode" "ac_cv_have_decl_strmode" "$ac_includes_default" | ||
| 13794 | if test "x$ac_cv_have_decl_strmode" = xyes; then : | ||
| 13795 | ac_have_decl=1 | ||
| 13796 | else | ||
| 13797 | ac_have_decl=0 | ||
| 13798 | fi | ||
| 13799 | |||
| 13800 | cat >>confdefs.h <<_ACEOF | ||
| 13801 | #define HAVE_DECL_STRMODE $ac_have_decl | ||
| 13802 | _ACEOF | ||
| 13803 | |||
| 13721 | 13804 | ||
| 13722 | GNULIB__EXIT=0; | 13805 | GNULIB__EXIT=0; |
| 13723 | GNULIB_ATOLL=0; | 13806 | GNULIB_ATOLL=0; |
| @@ -14770,6 +14853,84 @@ fi | |||
| 14770 | 14853 | ||
| 14771 | 14854 | ||
| 14772 | 14855 | ||
| 14856 | |||
| 14857 | GNULIB_FCHMODAT=0; | ||
| 14858 | GNULIB_FSTATAT=0; | ||
| 14859 | GNULIB_FUTIMENS=0; | ||
| 14860 | GNULIB_LCHMOD=0; | ||
| 14861 | GNULIB_LSTAT=0; | ||
| 14862 | GNULIB_MKDIRAT=0; | ||
| 14863 | GNULIB_MKFIFO=0; | ||
| 14864 | GNULIB_MKFIFOAT=0; | ||
| 14865 | GNULIB_MKNOD=0; | ||
| 14866 | GNULIB_MKNODAT=0; | ||
| 14867 | GNULIB_STAT=0; | ||
| 14868 | GNULIB_UTIMENSAT=0; | ||
| 14869 | HAVE_FCHMODAT=1; | ||
| 14870 | HAVE_FSTATAT=1; | ||
| 14871 | HAVE_FUTIMENS=1; | ||
| 14872 | HAVE_LCHMOD=1; | ||
| 14873 | HAVE_LSTAT=1; | ||
| 14874 | HAVE_MKDIRAT=1; | ||
| 14875 | HAVE_MKFIFO=1; | ||
| 14876 | HAVE_MKFIFOAT=1; | ||
| 14877 | HAVE_MKNOD=1; | ||
| 14878 | HAVE_MKNODAT=1; | ||
| 14879 | HAVE_UTIMENSAT=1; | ||
| 14880 | REPLACE_FSTAT=0; | ||
| 14881 | REPLACE_FSTATAT=0; | ||
| 14882 | REPLACE_FUTIMENS=0; | ||
| 14883 | REPLACE_LSTAT=0; | ||
| 14884 | REPLACE_MKDIR=0; | ||
| 14885 | REPLACE_MKFIFO=0; | ||
| 14886 | REPLACE_MKNOD=0; | ||
| 14887 | REPLACE_STAT=0; | ||
| 14888 | REPLACE_UTIMENSAT=0; | ||
| 14889 | |||
| 14890 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 | ||
| 14891 | $as_echo_n "checking whether stat file-mode macros are broken... " >&6; } | ||
| 14892 | if ${ac_cv_header_stat_broken+:} false; then : | ||
| 14893 | $as_echo_n "(cached) " >&6 | ||
| 14894 | else | ||
| 14895 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 14896 | /* end confdefs.h. */ | ||
| 14897 | #include <sys/types.h> | ||
| 14898 | #include <sys/stat.h> | ||
| 14899 | |||
| 14900 | #if defined S_ISBLK && defined S_IFDIR | ||
| 14901 | extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; | ||
| 14902 | #endif | ||
| 14903 | |||
| 14904 | #if defined S_ISBLK && defined S_IFCHR | ||
| 14905 | extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; | ||
| 14906 | #endif | ||
| 14907 | |||
| 14908 | #if defined S_ISLNK && defined S_IFREG | ||
| 14909 | extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; | ||
| 14910 | #endif | ||
| 14911 | |||
| 14912 | #if defined S_ISSOCK && defined S_IFREG | ||
| 14913 | extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; | ||
| 14914 | #endif | ||
| 14915 | |||
| 14916 | _ACEOF | ||
| 14917 | if ac_fn_c_try_compile "$LINENO"; then : | ||
| 14918 | ac_cv_header_stat_broken=no | ||
| 14919 | else | ||
| 14920 | ac_cv_header_stat_broken=yes | ||
| 14921 | fi | ||
| 14922 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
| 14923 | fi | ||
| 14924 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 | ||
| 14925 | $as_echo "$ac_cv_header_stat_broken" >&6; } | ||
| 14926 | if test $ac_cv_header_stat_broken = yes; then | ||
| 14927 | |||
| 14928 | $as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h | ||
| 14929 | |||
| 14930 | fi | ||
| 14931 | |||
| 14932 | |||
| 14933 | |||
| 14773 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 | 14934 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 |
| 14774 | $as_echo_n "checking for C/C++ restrict keyword... " >&6; } | 14935 | $as_echo_n "checking for C/C++ restrict keyword... " >&6; } |
| 14775 | if ${ac_cv_c_restrict+:} false; then : | 14936 | if ${ac_cv_c_restrict+:} false; then : |
| @@ -15033,6 +15194,21 @@ fi | |||
| 15033 | # Code from module dtoastr: | 15194 | # Code from module dtoastr: |
| 15034 | 15195 | ||
| 15035 | # Code from module extensions: | 15196 | # Code from module extensions: |
| 15197 | # Code from module filemode: | ||
| 15198 | |||
| 15199 | |||
| 15200 | |||
| 15201 | |||
| 15202 | |||
| 15203 | |||
| 15204 | |||
| 15205 | |||
| 15206 | |||
| 15207 | |||
| 15208 | gl_LIBOBJS="$gl_LIBOBJS filemode.$ac_objext" | ||
| 15209 | |||
| 15210 | |||
| 15211 | |||
| 15036 | # Code from module getloadavg: | 15212 | # Code from module getloadavg: |
| 15037 | 15213 | ||
| 15038 | 15214 | ||
| @@ -16783,6 +16959,90 @@ $as_echo "#define my_strftime nstrftime" >>confdefs.h | |||
| 16783 | 16959 | ||
| 16784 | 16960 | ||
| 16785 | 16961 | ||
| 16962 | # Code from module sys_stat: | ||
| 16963 | |||
| 16964 | |||
| 16965 | |||
| 16966 | |||
| 16967 | |||
| 16968 | |||
| 16969 | |||
| 16970 | |||
| 16971 | |||
| 16972 | |||
| 16973 | |||
| 16974 | |||
| 16975 | |||
| 16976 | |||
| 16977 | |||
| 16978 | |||
| 16979 | if test $gl_cv_have_include_next = yes; then | ||
| 16980 | gl_cv_next_sys_stat_h='<'sys/stat.h'>' | ||
| 16981 | else | ||
| 16982 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/stat.h>" >&5 | ||
| 16983 | $as_echo_n "checking absolute name of <sys/stat.h>... " >&6; } | ||
| 16984 | if ${gl_cv_next_sys_stat_h+:} false; then : | ||
| 16985 | $as_echo_n "(cached) " >&6 | ||
| 16986 | else | ||
| 16987 | |||
| 16988 | if test $ac_cv_header_sys_stat_h = yes; then | ||
| 16989 | |||
| 16990 | |||
| 16991 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 16992 | /* end confdefs.h. */ | ||
| 16993 | #include <sys/stat.h> | ||
| 16994 | |||
| 16995 | _ACEOF | ||
| 16996 | case "$host_os" in | ||
| 16997 | aix*) gl_absname_cpp="$ac_cpp -C" ;; | ||
| 16998 | *) gl_absname_cpp="$ac_cpp" ;; | ||
| 16999 | esac | ||
| 17000 | gl_cv_next_sys_stat_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | | ||
| 17001 | sed -n '\#/sys/stat.h#{ | ||
| 17002 | s#.*"\(.*/sys/stat.h\)".*#\1# | ||
| 17003 | s#^/[^/]#//&# | ||
| 17004 | p | ||
| 17005 | q | ||
| 17006 | }'`'"' | ||
| 17007 | else | ||
| 17008 | gl_cv_next_sys_stat_h='<'sys/stat.h'>' | ||
| 17009 | fi | ||
| 17010 | |||
| 17011 | |||
| 17012 | fi | ||
| 17013 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5 | ||
| 17014 | $as_echo "$gl_cv_next_sys_stat_h" >&6; } | ||
| 17015 | fi | ||
| 17016 | NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h | ||
| 17017 | |||
| 17018 | if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then | ||
| 17019 | # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' | ||
| 17020 | gl_next_as_first_directive='<'sys/stat.h'>' | ||
| 17021 | else | ||
| 17022 | # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' | ||
| 17023 | gl_next_as_first_directive=$gl_cv_next_sys_stat_h | ||
| 17024 | fi | ||
| 17025 | NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive | ||
| 17026 | |||
| 17027 | |||
| 17028 | |||
| 17029 | |||
| 17030 | |||
| 17031 | ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include <sys/types.h> | ||
| 17032 | #include <sys/stat.h> | ||
| 17033 | " | ||
| 17034 | if test "x$ac_cv_type_nlink_t" = xyes; then : | ||
| 17035 | |||
| 17036 | else | ||
| 17037 | |||
| 17038 | $as_echo "#define nlink_t int" >>confdefs.h | ||
| 17039 | |||
| 17040 | fi | ||
| 17041 | |||
| 17042 | |||
| 17043 | |||
| 17044 | |||
| 17045 | |||
| 16786 | # Code from module time: | 17046 | # Code from module time: |
| 16787 | 17047 | ||
| 16788 | 17048 | ||
diff --git a/lib/Makefile.am b/lib/Makefile.am index 6a014f6057b..220ba713d4e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | BUILT_SOURCES = | 1 | BUILT_SOURCES = |
| 2 | EXTRA_DIST = | 2 | EXTRA_DIST = |
| 3 | MOSTLYCLEANDIRS = | ||
| 3 | MOSTLYCLEANFILES = | 4 | MOSTLYCLEANFILES = |
| 4 | noinst_LIBRARIES = | 5 | noinst_LIBRARIES = |
| 5 | 6 | ||
diff --git a/lib/Makefile.in b/lib/Makefile.in index 0029719373a..b16587bbddc 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | # the same distribution terms as the rest of that program. | 24 | # the same distribution terms as the rest of that program. |
| 25 | # | 25 | # |
| 26 | # Generated by gnulib-tool. | 26 | # Generated by gnulib-tool. |
| 27 | # 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 | 27 | # 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 |
| 28 | 28 | ||
| 29 | VPATH = @srcdir@ | 29 | VPATH = @srcdir@ |
| 30 | pkgdatadir = $(datadir)/@PACKAGE@ | 30 | pkgdatadir = $(datadir)/@PACKAGE@ |
| @@ -51,13 +51,15 @@ subdir = lib | |||
| 51 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | 51 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
| 52 | am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ | 52 | am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ |
| 53 | $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ | 53 | $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ |
| 54 | $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ | 54 | $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \ |
| 55 | $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \ | 55 | $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \ |
| 56 | $(top_srcdir)/m4/gnulib-common.m4 \ | ||
| 56 | $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ | 57 | $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ |
| 57 | $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \ | 58 | $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \ |
| 58 | $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \ | 59 | $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ |
| 59 | $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ | 60 | $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ |
| 60 | $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \ | 61 | $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdlib_h.m4 \ |
| 62 | $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ | ||
| 61 | $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ | 63 | $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ |
| 62 | $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ | 64 | $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ |
| 63 | $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in | 65 | $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in |
| @@ -152,9 +154,12 @@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ | |||
| 152 | GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ | 154 | GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ |
| 153 | GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ | 155 | GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ |
| 154 | GNULIB_FCHDIR = @GNULIB_FCHDIR@ | 156 | GNULIB_FCHDIR = @GNULIB_FCHDIR@ |
| 157 | GNULIB_FCHMODAT = @GNULIB_FCHMODAT@ | ||
| 155 | GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ | 158 | GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ |
| 159 | GNULIB_FSTATAT = @GNULIB_FSTATAT@ | ||
| 156 | GNULIB_FSYNC = @GNULIB_FSYNC@ | 160 | GNULIB_FSYNC = @GNULIB_FSYNC@ |
| 157 | GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ | 161 | GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ |
| 162 | GNULIB_FUTIMENS = @GNULIB_FUTIMENS@ | ||
| 158 | GNULIB_GETCWD = @GNULIB_GETCWD@ | 163 | GNULIB_GETCWD = @GNULIB_GETCWD@ |
| 159 | GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ | 164 | GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ |
| 160 | GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ | 165 | GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ |
| @@ -167,12 +172,19 @@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ | |||
| 167 | GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ | 172 | GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ |
| 168 | GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ | 173 | GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ |
| 169 | GNULIB_GRANTPT = @GNULIB_GRANTPT@ | 174 | GNULIB_GRANTPT = @GNULIB_GRANTPT@ |
| 175 | GNULIB_LCHMOD = @GNULIB_LCHMOD@ | ||
| 170 | GNULIB_LCHOWN = @GNULIB_LCHOWN@ | 176 | GNULIB_LCHOWN = @GNULIB_LCHOWN@ |
| 171 | GNULIB_LINK = @GNULIB_LINK@ | 177 | GNULIB_LINK = @GNULIB_LINK@ |
| 172 | GNULIB_LINKAT = @GNULIB_LINKAT@ | 178 | GNULIB_LINKAT = @GNULIB_LINKAT@ |
| 173 | GNULIB_LSEEK = @GNULIB_LSEEK@ | 179 | GNULIB_LSEEK = @GNULIB_LSEEK@ |
| 180 | GNULIB_LSTAT = @GNULIB_LSTAT@ | ||
| 174 | GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ | 181 | GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ |
| 182 | GNULIB_MKDIRAT = @GNULIB_MKDIRAT@ | ||
| 175 | GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ | 183 | GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ |
| 184 | GNULIB_MKFIFO = @GNULIB_MKFIFO@ | ||
| 185 | GNULIB_MKFIFOAT = @GNULIB_MKFIFOAT@ | ||
| 186 | GNULIB_MKNOD = @GNULIB_MKNOD@ | ||
| 187 | GNULIB_MKNODAT = @GNULIB_MKNODAT@ | ||
| 176 | GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ | 188 | GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ |
| 177 | GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ | 189 | GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ |
| 178 | GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ | 190 | GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ |
| @@ -194,6 +206,7 @@ GNULIB_RMDIR = @GNULIB_RMDIR@ | |||
| 194 | GNULIB_RPMATCH = @GNULIB_RPMATCH@ | 206 | GNULIB_RPMATCH = @GNULIB_RPMATCH@ |
| 195 | GNULIB_SETENV = @GNULIB_SETENV@ | 207 | GNULIB_SETENV = @GNULIB_SETENV@ |
| 196 | GNULIB_SLEEP = @GNULIB_SLEEP@ | 208 | GNULIB_SLEEP = @GNULIB_SLEEP@ |
| 209 | GNULIB_STAT = @GNULIB_STAT@ | ||
| 197 | GNULIB_STRPTIME = @GNULIB_STRPTIME@ | 210 | GNULIB_STRPTIME = @GNULIB_STRPTIME@ |
| 198 | GNULIB_STRTOD = @GNULIB_STRTOD@ | 211 | GNULIB_STRTOD = @GNULIB_STRTOD@ |
| 199 | GNULIB_STRTOLL = @GNULIB_STRTOLL@ | 212 | GNULIB_STRTOLL = @GNULIB_STRTOLL@ |
| @@ -211,6 +224,7 @@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ | |||
| 211 | GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ | 224 | GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ |
| 212 | GNULIB_UNSETENV = @GNULIB_UNSETENV@ | 225 | GNULIB_UNSETENV = @GNULIB_UNSETENV@ |
| 213 | GNULIB_USLEEP = @GNULIB_USLEEP@ | 226 | GNULIB_USLEEP = @GNULIB_USLEEP@ |
| 227 | GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@ | ||
| 214 | GNULIB_WRITE = @GNULIB_WRITE@ | 228 | GNULIB_WRITE = @GNULIB_WRITE@ |
| 215 | GNULIB__EXIT = @GNULIB__EXIT@ | 229 | GNULIB__EXIT = @GNULIB__EXIT@ |
| 216 | GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ | 230 | GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ |
| @@ -239,9 +253,12 @@ HAVE_DUP3 = @HAVE_DUP3@ | |||
| 239 | HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ | 253 | HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ |
| 240 | HAVE_FACCESSAT = @HAVE_FACCESSAT@ | 254 | HAVE_FACCESSAT = @HAVE_FACCESSAT@ |
| 241 | HAVE_FCHDIR = @HAVE_FCHDIR@ | 255 | HAVE_FCHDIR = @HAVE_FCHDIR@ |
| 256 | HAVE_FCHMODAT = @HAVE_FCHMODAT@ | ||
| 242 | HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ | 257 | HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ |
| 258 | HAVE_FSTATAT = @HAVE_FSTATAT@ | ||
| 243 | HAVE_FSYNC = @HAVE_FSYNC@ | 259 | HAVE_FSYNC = @HAVE_FSYNC@ |
| 244 | HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ | 260 | HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ |
| 261 | HAVE_FUTIMENS = @HAVE_FUTIMENS@ | ||
| 245 | HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ | 262 | HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ |
| 246 | HAVE_GETGROUPS = @HAVE_GETGROUPS@ | 263 | HAVE_GETGROUPS = @HAVE_GETGROUPS@ |
| 247 | HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ | 264 | HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ |
| @@ -251,12 +268,19 @@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ | |||
| 251 | HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ | 268 | HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ |
| 252 | HAVE_GRANTPT = @HAVE_GRANTPT@ | 269 | HAVE_GRANTPT = @HAVE_GRANTPT@ |
| 253 | HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ | 270 | HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ |
| 271 | HAVE_LCHMOD = @HAVE_LCHMOD@ | ||
| 254 | HAVE_LCHOWN = @HAVE_LCHOWN@ | 272 | HAVE_LCHOWN = @HAVE_LCHOWN@ |
| 255 | HAVE_LINK = @HAVE_LINK@ | 273 | HAVE_LINK = @HAVE_LINK@ |
| 256 | HAVE_LINKAT = @HAVE_LINKAT@ | 274 | HAVE_LINKAT = @HAVE_LINKAT@ |
| 257 | HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ | 275 | HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ |
| 276 | HAVE_LSTAT = @HAVE_LSTAT@ | ||
| 258 | HAVE_MAKEINFO = @HAVE_MAKEINFO@ | 277 | HAVE_MAKEINFO = @HAVE_MAKEINFO@ |
| 278 | HAVE_MKDIRAT = @HAVE_MKDIRAT@ | ||
| 259 | HAVE_MKDTEMP = @HAVE_MKDTEMP@ | 279 | HAVE_MKDTEMP = @HAVE_MKDTEMP@ |
| 280 | HAVE_MKFIFO = @HAVE_MKFIFO@ | ||
| 281 | HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ | ||
| 282 | HAVE_MKNOD = @HAVE_MKNOD@ | ||
| 283 | HAVE_MKNODAT = @HAVE_MKNODAT@ | ||
| 260 | HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ | 284 | HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ |
| 261 | HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ | 285 | HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ |
| 262 | HAVE_MKSTEMP = @HAVE_MKSTEMP@ | 286 | HAVE_MKSTEMP = @HAVE_MKSTEMP@ |
| @@ -298,6 +322,7 @@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ | |||
| 298 | HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ | 322 | HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ |
| 299 | HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ | 323 | HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ |
| 300 | HAVE_USLEEP = @HAVE_USLEEP@ | 324 | HAVE_USLEEP = @HAVE_USLEEP@ |
| 325 | HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ | ||
| 301 | HAVE_WCHAR_H = @HAVE_WCHAR_H@ | 326 | HAVE_WCHAR_H = @HAVE_WCHAR_H@ |
| 302 | HAVE_WCHAR_T = @HAVE_WCHAR_T@ | 327 | HAVE_WCHAR_T = @HAVE_WCHAR_T@ |
| 303 | HAVE_XSERVER = @HAVE_XSERVER@ | 328 | HAVE_XSERVER = @HAVE_XSERVER@ |
| @@ -369,12 +394,14 @@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ | |||
| 369 | NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ | 394 | NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ |
| 370 | NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ | 395 | NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ |
| 371 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ | 396 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ |
| 397 | NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ | ||
| 372 | NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ | 398 | NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ |
| 373 | NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ | 399 | NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ |
| 374 | NEXT_GETOPT_H = @NEXT_GETOPT_H@ | 400 | NEXT_GETOPT_H = @NEXT_GETOPT_H@ |
| 375 | NEXT_STDDEF_H = @NEXT_STDDEF_H@ | 401 | NEXT_STDDEF_H = @NEXT_STDDEF_H@ |
| 376 | NEXT_STDINT_H = @NEXT_STDINT_H@ | 402 | NEXT_STDINT_H = @NEXT_STDINT_H@ |
| 377 | NEXT_STDLIB_H = @NEXT_STDLIB_H@ | 403 | NEXT_STDLIB_H = @NEXT_STDLIB_H@ |
| 404 | NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ | ||
| 378 | NEXT_TIME_H = @NEXT_TIME_H@ | 405 | NEXT_TIME_H = @NEXT_TIME_H@ |
| 379 | NEXT_UNISTD_H = @NEXT_UNISTD_H@ | 406 | NEXT_UNISTD_H = @NEXT_UNISTD_H@ |
| 380 | NS_OBJ = @NS_OBJ@ | 407 | NS_OBJ = @NS_OBJ@ |
| @@ -410,6 +437,9 @@ REPLACE_CLOSE = @REPLACE_CLOSE@ | |||
| 410 | REPLACE_DUP = @REPLACE_DUP@ | 437 | REPLACE_DUP = @REPLACE_DUP@ |
| 411 | REPLACE_DUP2 = @REPLACE_DUP2@ | 438 | REPLACE_DUP2 = @REPLACE_DUP2@ |
| 412 | REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ | 439 | REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ |
| 440 | REPLACE_FSTAT = @REPLACE_FSTAT@ | ||
| 441 | REPLACE_FSTATAT = @REPLACE_FSTATAT@ | ||
| 442 | REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ | ||
| 413 | REPLACE_GETCWD = @REPLACE_GETCWD@ | 443 | REPLACE_GETCWD = @REPLACE_GETCWD@ |
| 414 | REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ | 444 | REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ |
| 415 | REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ | 445 | REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ |
| @@ -420,7 +450,11 @@ REPLACE_LINK = @REPLACE_LINK@ | |||
| 420 | REPLACE_LINKAT = @REPLACE_LINKAT@ | 450 | REPLACE_LINKAT = @REPLACE_LINKAT@ |
| 421 | REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ | 451 | REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ |
| 422 | REPLACE_LSEEK = @REPLACE_LSEEK@ | 452 | REPLACE_LSEEK = @REPLACE_LSEEK@ |
| 453 | REPLACE_LSTAT = @REPLACE_LSTAT@ | ||
| 423 | REPLACE_MALLOC = @REPLACE_MALLOC@ | 454 | REPLACE_MALLOC = @REPLACE_MALLOC@ |
| 455 | REPLACE_MKDIR = @REPLACE_MKDIR@ | ||
| 456 | REPLACE_MKFIFO = @REPLACE_MKFIFO@ | ||
| 457 | REPLACE_MKNOD = @REPLACE_MKNOD@ | ||
| 424 | REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ | 458 | REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ |
| 425 | REPLACE_MKTIME = @REPLACE_MKTIME@ | 459 | REPLACE_MKTIME = @REPLACE_MKTIME@ |
| 426 | REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ | 460 | REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ |
| @@ -434,6 +468,7 @@ REPLACE_REALPATH = @REPLACE_REALPATH@ | |||
| 434 | REPLACE_RMDIR = @REPLACE_RMDIR@ | 468 | REPLACE_RMDIR = @REPLACE_RMDIR@ |
| 435 | REPLACE_SETENV = @REPLACE_SETENV@ | 469 | REPLACE_SETENV = @REPLACE_SETENV@ |
| 436 | REPLACE_SLEEP = @REPLACE_SLEEP@ | 470 | REPLACE_SLEEP = @REPLACE_SLEEP@ |
| 471 | REPLACE_STAT = @REPLACE_STAT@ | ||
| 437 | REPLACE_STRTOD = @REPLACE_STRTOD@ | 472 | REPLACE_STRTOD = @REPLACE_STRTOD@ |
| 438 | REPLACE_SYMLINK = @REPLACE_SYMLINK@ | 473 | REPLACE_SYMLINK = @REPLACE_SYMLINK@ |
| 439 | REPLACE_TIMEGM = @REPLACE_TIMEGM@ | 474 | REPLACE_TIMEGM = @REPLACE_TIMEGM@ |
| @@ -442,6 +477,7 @@ REPLACE_UNLINK = @REPLACE_UNLINK@ | |||
| 442 | REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ | 477 | REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ |
| 443 | REPLACE_UNSETENV = @REPLACE_UNSETENV@ | 478 | REPLACE_UNSETENV = @REPLACE_UNSETENV@ |
| 444 | REPLACE_USLEEP = @REPLACE_USLEEP@ | 479 | REPLACE_USLEEP = @REPLACE_USLEEP@ |
| 480 | REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ | ||
| 445 | REPLACE_WRITE = @REPLACE_WRITE@ | 481 | REPLACE_WRITE = @REPLACE_WRITE@ |
| 446 | RSVG_CFLAGS = @RSVG_CFLAGS@ | 482 | RSVG_CFLAGS = @RSVG_CFLAGS@ |
| 447 | RSVG_LIBS = @RSVG_LIBS@ | 483 | RSVG_LIBS = @RSVG_LIBS@ |
| @@ -559,25 +595,27 @@ x_default_search_path = @x_default_search_path@ | |||
| 559 | # present in all Makefile.am that need it. This is ensured by the applicability | 595 | # present in all Makefile.am that need it. This is ensured by the applicability |
| 560 | # 'all' defined above. | 596 | # 'all' defined above. |
| 561 | BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ | 597 | BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ |
| 562 | $(STDDEF_H) $(STDINT_H) stdlib.h time.h unistd.h warn-on-use.h | 598 | $(STDDEF_H) $(STDINT_H) stdlib.h sys/stat.h time.h unistd.h \ |
| 599 | warn-on-use.h | ||
| 563 | EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ | 600 | EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ |
| 564 | md5.c md5.h ftoastr.c ftoastr.h getloadavg.c getopt.c \ | 601 | md5.c md5.h ftoastr.c ftoastr.h filemode.c filemode.h \ |
| 565 | getopt.in.h getopt1.c getopt_int.h intprops.h \ | 602 | getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \ |
| 566 | mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ | 603 | intprops.h mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ |
| 567 | stdint.in.h stdlib.in.h strftime.c strftime.h time.in.h \ | 604 | stdint.in.h stdlib.in.h strftime.c strftime.h sys_stat.in.h \ |
| 568 | time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h | 605 | time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h |
| 606 | MOSTLYCLEANDIRS = sys | ||
| 569 | MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ | 607 | MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ |
| 570 | c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ | 608 | c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ |
| 571 | stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdlib.h \ | 609 | stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdlib.h \ |
| 572 | stdlib.h-t time.h time.h-t unistd.h unistd.h-t warn-on-use.h \ | 610 | stdlib.h-t sys/stat.h sys/stat.h-t time.h time.h-t unistd.h \ |
| 573 | warn-on-use.h-t | 611 | unistd.h-t warn-on-use.h warn-on-use.h-t |
| 574 | noinst_LIBRARIES = libgnu.a | 612 | noinst_LIBRARIES = libgnu.a |
| 575 | DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src | 613 | DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src |
| 576 | libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h | 614 | libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h |
| 577 | libgnu_a_LIBADD = $(gl_LIBOBJS) | 615 | libgnu_a_LIBADD = $(gl_LIBOBJS) |
| 578 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) | 616 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) |
| 579 | EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c getloadavg.c getopt.c \ | 617 | EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c filemode.c getloadavg.c \ |
| 580 | getopt1.c mktime.c strftime.c time_r.c | 618 | getopt.c getopt1.c mktime.c strftime.c time_r.c |
| 581 | ARG_NONNULL_H = arg-nonnull.h | 619 | ARG_NONNULL_H = arg-nonnull.h |
| 582 | CXXDEFS_H = c++defs.h | 620 | CXXDEFS_H = c++defs.h |
| 583 | WARN_ON_USE_H = warn-on-use.h | 621 | WARN_ON_USE_H = warn-on-use.h |
| @@ -631,6 +669,7 @@ distclean-compile: | |||
| 631 | -rm -f *.tab.c | 669 | -rm -f *.tab.c |
| 632 | 670 | ||
| 633 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@ | 671 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@ |
| 672 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemode.Po@am__quote@ | ||
| 634 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@ | 673 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@ |
| 635 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ | 674 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ |
| 636 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ | 675 | @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) | |||
| 1021 | } > $@-t && \ | 1060 | } > $@-t && \ |
| 1022 | mv $@-t $@ | 1061 | mv $@-t $@ |
| 1023 | 1062 | ||
| 1063 | # We need the following in order to create <sys/stat.h> when the system | ||
| 1064 | # has one that is incomplete. | ||
| 1065 | sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | ||
| 1066 | $(AM_V_at)$(MKDIR_P) sys | ||
| 1067 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 1068 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 1069 | sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 1070 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 1071 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 1072 | -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ | ||
| 1073 | -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ | ||
| 1074 | -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ | ||
| 1075 | -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ | ||
| 1076 | -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ | ||
| 1077 | -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ | ||
| 1078 | -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ | ||
| 1079 | -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ | ||
| 1080 | -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ | ||
| 1081 | -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ | ||
| 1082 | -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ | ||
| 1083 | -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ | ||
| 1084 | -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ | ||
| 1085 | -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ | ||
| 1086 | -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ | ||
| 1087 | -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ | ||
| 1088 | -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ | ||
| 1089 | -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ | ||
| 1090 | -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ | ||
| 1091 | -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ | ||
| 1092 | -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ | ||
| 1093 | -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ | ||
| 1094 | -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ | ||
| 1095 | -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ | ||
| 1096 | -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ | ||
| 1097 | -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ | ||
| 1098 | -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ | ||
| 1099 | -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ | ||
| 1100 | -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ | ||
| 1101 | -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ | ||
| 1102 | -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ | ||
| 1103 | -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ | ||
| 1104 | -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ | ||
| 1105 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | ||
| 1106 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | ||
| 1107 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | ||
| 1108 | < $(srcdir)/sys_stat.in.h; \ | ||
| 1109 | } > $@-t && \ | ||
| 1110 | mv $@-t $@ | ||
| 1111 | |||
| 1024 | # We need the following in order to create <time.h> when the system | 1112 | # We need the following in order to create <time.h> when the system |
| 1025 | # doesn't have one that works with the given compiler. | 1113 | # doesn't have one that works with the given compiler. |
| 1026 | time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | 1114 | time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) |
diff --git a/lib/filemode.c b/lib/filemode.c new file mode 100644 index 00000000000..0f6641ace6a --- /dev/null +++ b/lib/filemode.c | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | /* filemode.c -- make a string describing file modes | ||
| 2 | |||
| 3 | Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2011 Free | ||
| 4 | Software Foundation, Inc. | ||
| 5 | |||
| 6 | This program is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | #include <config.h> | ||
| 20 | |||
| 21 | #include "filemode.h" | ||
| 22 | |||
| 23 | /* The following is for Cray DMF (Data Migration Facility), which is a | ||
| 24 | HSM file system. A migrated file has a `st_dm_mode' that is | ||
| 25 | different from the normal `st_mode', so any tests for migrated | ||
| 26 | files should use the former. */ | ||
| 27 | #if HAVE_ST_DM_MODE | ||
| 28 | # define IS_MIGRATED_FILE(statp) \ | ||
| 29 | (S_ISOFD (statp->st_dm_mode) || S_ISOFL (statp->st_dm_mode)) | ||
| 30 | #else | ||
| 31 | # define IS_MIGRATED_FILE(statp) 0 | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #if ! HAVE_DECL_STRMODE | ||
| 35 | |||
| 36 | /* Return a character indicating the type of file described by | ||
| 37 | file mode BITS: | ||
| 38 | '-' regular file | ||
| 39 | 'b' block special file | ||
| 40 | 'c' character special file | ||
| 41 | 'C' high performance ("contiguous data") file | ||
| 42 | 'd' directory | ||
| 43 | 'D' door | ||
| 44 | 'l' symbolic link | ||
| 45 | 'm' multiplexed file (7th edition Unix; obsolete) | ||
| 46 | 'n' network special file (HP-UX) | ||
| 47 | 'p' fifo (named pipe) | ||
| 48 | 'P' port | ||
| 49 | 's' socket | ||
| 50 | 'w' whiteout (4.4BSD) | ||
| 51 | '?' some other file type */ | ||
| 52 | |||
| 53 | static char | ||
| 54 | ftypelet (mode_t bits) | ||
| 55 | { | ||
| 56 | /* These are the most common, so test for them first. */ | ||
| 57 | if (S_ISREG (bits)) | ||
| 58 | return '-'; | ||
| 59 | if (S_ISDIR (bits)) | ||
| 60 | return 'd'; | ||
| 61 | |||
| 62 | /* Other letters standardized by POSIX 1003.1-2004. */ | ||
| 63 | if (S_ISBLK (bits)) | ||
| 64 | return 'b'; | ||
| 65 | if (S_ISCHR (bits)) | ||
| 66 | return 'c'; | ||
| 67 | if (S_ISLNK (bits)) | ||
| 68 | return 'l'; | ||
| 69 | if (S_ISFIFO (bits)) | ||
| 70 | return 'p'; | ||
| 71 | |||
| 72 | /* Other file types (though not letters) standardized by POSIX. */ | ||
| 73 | if (S_ISSOCK (bits)) | ||
| 74 | return 's'; | ||
| 75 | |||
| 76 | /* Nonstandard file types. */ | ||
| 77 | if (S_ISCTG (bits)) | ||
| 78 | return 'C'; | ||
| 79 | if (S_ISDOOR (bits)) | ||
| 80 | return 'D'; | ||
| 81 | if (S_ISMPB (bits) || S_ISMPC (bits)) | ||
| 82 | return 'm'; | ||
| 83 | if (S_ISNWK (bits)) | ||
| 84 | return 'n'; | ||
| 85 | if (S_ISPORT (bits)) | ||
| 86 | return 'P'; | ||
| 87 | if (S_ISWHT (bits)) | ||
| 88 | return 'w'; | ||
| 89 | |||
| 90 | return '?'; | ||
| 91 | } | ||
| 92 | |||
| 93 | /* Like filemodestring, but rely only on MODE. */ | ||
| 94 | |||
| 95 | void | ||
| 96 | strmode (mode_t mode, char *str) | ||
| 97 | { | ||
| 98 | str[0] = ftypelet (mode); | ||
| 99 | str[1] = mode & S_IRUSR ? 'r' : '-'; | ||
| 100 | str[2] = mode & S_IWUSR ? 'w' : '-'; | ||
| 101 | str[3] = (mode & S_ISUID | ||
| 102 | ? (mode & S_IXUSR ? 's' : 'S') | ||
| 103 | : (mode & S_IXUSR ? 'x' : '-')); | ||
| 104 | str[4] = mode & S_IRGRP ? 'r' : '-'; | ||
| 105 | str[5] = mode & S_IWGRP ? 'w' : '-'; | ||
| 106 | str[6] = (mode & S_ISGID | ||
| 107 | ? (mode & S_IXGRP ? 's' : 'S') | ||
| 108 | : (mode & S_IXGRP ? 'x' : '-')); | ||
| 109 | str[7] = mode & S_IROTH ? 'r' : '-'; | ||
| 110 | str[8] = mode & S_IWOTH ? 'w' : '-'; | ||
| 111 | str[9] = (mode & S_ISVTX | ||
| 112 | ? (mode & S_IXOTH ? 't' : 'T') | ||
| 113 | : (mode & S_IXOTH ? 'x' : '-')); | ||
| 114 | str[10] = ' '; | ||
| 115 | str[11] = '\0'; | ||
| 116 | } | ||
| 117 | |||
| 118 | #endif /* ! HAVE_DECL_STRMODE */ | ||
| 119 | |||
| 120 | /* filemodestring - fill in string STR with an ls-style ASCII | ||
| 121 | representation of the st_mode field of file stats block STATP. | ||
| 122 | 12 characters are stored in STR. | ||
| 123 | The characters stored in STR are: | ||
| 124 | |||
| 125 | 0 File type, as in ftypelet above, except that other letters are used | ||
| 126 | for files whose type cannot be determined solely from st_mode: | ||
| 127 | |||
| 128 | 'F' semaphore | ||
| 129 | 'M' migrated file (Cray DMF) | ||
| 130 | 'Q' message queue | ||
| 131 | 'S' shared memory object | ||
| 132 | 'T' typed memory object | ||
| 133 | |||
| 134 | 1 'r' if the owner may read, '-' otherwise. | ||
| 135 | |||
| 136 | 2 'w' if the owner may write, '-' otherwise. | ||
| 137 | |||
| 138 | 3 'x' if the owner may execute, 's' if the file is | ||
| 139 | set-user-id, '-' otherwise. | ||
| 140 | 'S' if the file is set-user-id, but the execute | ||
| 141 | bit isn't set. | ||
| 142 | |||
| 143 | 4 'r' if group members may read, '-' otherwise. | ||
| 144 | |||
| 145 | 5 'w' if group members may write, '-' otherwise. | ||
| 146 | |||
| 147 | 6 'x' if group members may execute, 's' if the file is | ||
| 148 | set-group-id, '-' otherwise. | ||
| 149 | 'S' if it is set-group-id but not executable. | ||
| 150 | |||
| 151 | 7 'r' if any user may read, '-' otherwise. | ||
| 152 | |||
| 153 | 8 'w' if any user may write, '-' otherwise. | ||
| 154 | |||
| 155 | 9 'x' if any user may execute, 't' if the file is "sticky" | ||
| 156 | (will be retained in swap space after execution), '-' | ||
| 157 | otherwise. | ||
| 158 | 'T' if the file is sticky but not executable. | ||
| 159 | |||
| 160 | 10 ' ' for compatibility with 4.4BSD strmode, | ||
| 161 | since this interface does not support ACLs. | ||
| 162 | |||
| 163 | 11 '\0'. */ | ||
| 164 | |||
| 165 | void | ||
| 166 | filemodestring (struct stat const *statp, char *str) | ||
| 167 | { | ||
| 168 | strmode (statp->st_mode, str); | ||
| 169 | |||
| 170 | if (S_TYPEISSEM (statp)) | ||
| 171 | str[0] = 'F'; | ||
| 172 | else if (IS_MIGRATED_FILE (statp)) | ||
| 173 | str[0] = 'M'; | ||
| 174 | else if (S_TYPEISMQ (statp)) | ||
| 175 | str[0] = 'Q'; | ||
| 176 | else if (S_TYPEISSHM (statp)) | ||
| 177 | str[0] = 'S'; | ||
| 178 | else if (S_TYPEISTMO (statp)) | ||
| 179 | str[0] = 'T'; | ||
| 180 | } | ||
diff --git a/lib/filemode.h b/lib/filemode.h new file mode 100644 index 00000000000..1a50302704c --- /dev/null +++ b/lib/filemode.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* Make a string describing file modes. | ||
| 2 | |||
| 3 | Copyright (C) 1998-1999, 2003, 2006, 2009-2011 Free Software Foundation, | ||
| 4 | Inc. | ||
| 5 | |||
| 6 | This program is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | #ifndef FILEMODE_H_ | ||
| 20 | |||
| 21 | # include <sys/types.h> | ||
| 22 | # include <sys/stat.h> | ||
| 23 | |||
| 24 | /* Get the declaration of strmode. */ | ||
| 25 | # if HAVE_DECL_STRMODE | ||
| 26 | # include <string.h> /* MacOS X, FreeBSD, OpenBSD */ | ||
| 27 | # include <unistd.h> /* NetBSD */ | ||
| 28 | # endif | ||
| 29 | |||
| 30 | # ifdef __cplusplus | ||
| 31 | extern "C" { | ||
| 32 | # endif | ||
| 33 | |||
| 34 | # if !HAVE_DECL_STRMODE | ||
| 35 | extern void strmode (mode_t mode, char *str); | ||
| 36 | # endif | ||
| 37 | |||
| 38 | extern void filemodestring (struct stat const *statp, char *str); | ||
| 39 | |||
| 40 | # ifdef __cplusplus | ||
| 41 | } | ||
| 42 | # endif | ||
| 43 | |||
| 44 | #endif | ||
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 3e93e12d9bf..bdba2e9c1bb 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | # the same distribution terms as the rest of that program. | 9 | # the same distribution terms as the rest of that program. |
| 10 | # | 10 | # |
| 11 | # Generated by gnulib-tool. | 11 | # Generated by gnulib-tool. |
| 12 | # 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 | 12 | # 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 |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | MOSTLYCLEANFILES += core *.stackdump | 15 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -88,6 +88,15 @@ EXTRA_libgnu_a_SOURCES += ftoastr.c | |||
| 88 | 88 | ||
| 89 | ## end gnulib module dtoastr | 89 | ## end gnulib module dtoastr |
| 90 | 90 | ||
| 91 | ## begin gnulib module filemode | ||
| 92 | |||
| 93 | |||
| 94 | EXTRA_DIST += filemode.c filemode.h | ||
| 95 | |||
| 96 | EXTRA_libgnu_a_SOURCES += filemode.c | ||
| 97 | |||
| 98 | ## end gnulib module filemode | ||
| 99 | |||
| 91 | ## begin gnulib module getloadavg | 100 | ## begin gnulib module getloadavg |
| 92 | 101 | ||
| 93 | 102 | ||
| @@ -331,6 +340,65 @@ EXTRA_libgnu_a_SOURCES += strftime.c | |||
| 331 | 340 | ||
| 332 | ## end gnulib module strftime | 341 | ## end gnulib module strftime |
| 333 | 342 | ||
| 343 | ## begin gnulib module sys_stat | ||
| 344 | |||
| 345 | BUILT_SOURCES += sys/stat.h | ||
| 346 | |||
| 347 | # We need the following in order to create <sys/stat.h> when the system | ||
| 348 | # has one that is incomplete. | ||
| 349 | sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | ||
| 350 | $(AM_V_at)$(MKDIR_P) sys | ||
| 351 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 352 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 353 | sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 354 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 355 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 356 | -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ | ||
| 357 | -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ | ||
| 358 | -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ | ||
| 359 | -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ | ||
| 360 | -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ | ||
| 361 | -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ | ||
| 362 | -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ | ||
| 363 | -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ | ||
| 364 | -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ | ||
| 365 | -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ | ||
| 366 | -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ | ||
| 367 | -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ | ||
| 368 | -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ | ||
| 369 | -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ | ||
| 370 | -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ | ||
| 371 | -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ | ||
| 372 | -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ | ||
| 373 | -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ | ||
| 374 | -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ | ||
| 375 | -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ | ||
| 376 | -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ | ||
| 377 | -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ | ||
| 378 | -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ | ||
| 379 | -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ | ||
| 380 | -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ | ||
| 381 | -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ | ||
| 382 | -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ | ||
| 383 | -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ | ||
| 384 | -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ | ||
| 385 | -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ | ||
| 386 | -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ | ||
| 387 | -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ | ||
| 388 | -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ | ||
| 389 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | ||
| 390 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | ||
| 391 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | ||
| 392 | < $(srcdir)/sys_stat.in.h; \ | ||
| 393 | } > $@-t && \ | ||
| 394 | mv $@-t $@ | ||
| 395 | MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t | ||
| 396 | MOSTLYCLEANDIRS += sys | ||
| 397 | |||
| 398 | EXTRA_DIST += sys_stat.in.h | ||
| 399 | |||
| 400 | ## end gnulib module sys_stat | ||
| 401 | |||
| 334 | ## begin gnulib module time | 402 | ## begin gnulib module time |
| 335 | 403 | ||
| 336 | BUILT_SOURCES += time.h | 404 | BUILT_SOURCES += time.h |
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h new file mode 100644 index 00000000000..61cdcc53928 --- /dev/null +++ b/lib/sys_stat.in.h | |||
| @@ -0,0 +1,646 @@ | |||
| 1 | /* Provide a more complete sys/stat header file. | ||
| 2 | Copyright (C) 2005-2011 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, write to the Free Software Foundation, | ||
| 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 17 | |||
| 18 | /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ | ||
| 19 | |||
| 20 | /* This file is supposed to be used on platforms where <sys/stat.h> is | ||
| 21 | incomplete. It is intended to provide definitions and prototypes | ||
| 22 | needed by an application. Start with what the system provides. */ | ||
| 23 | |||
| 24 | #if __GNUC__ >= 3 | ||
| 25 | @PRAGMA_SYSTEM_HEADER@ | ||
| 26 | #endif | ||
| 27 | @PRAGMA_COLUMNS@ | ||
| 28 | |||
| 29 | #if defined __need_system_sys_stat_h | ||
| 30 | /* Special invocation convention. */ | ||
| 31 | |||
| 32 | #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ | ||
| 33 | |||
| 34 | #else | ||
| 35 | /* Normal invocation convention. */ | ||
| 36 | |||
| 37 | #ifndef _GL_SYS_STAT_H | ||
| 38 | |||
| 39 | /* Get nlink_t. */ | ||
| 40 | #include <sys/types.h> | ||
| 41 | |||
| 42 | /* Get struct timespec. */ | ||
| 43 | #include <time.h> | ||
| 44 | |||
| 45 | /* The include_next requires a split double-inclusion guard. */ | ||
| 46 | #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ | ||
| 47 | |||
| 48 | #ifndef _GL_SYS_STAT_H | ||
| 49 | #define _GL_SYS_STAT_H | ||
| 50 | |||
| 51 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
| 52 | |||
| 53 | /* The definition of _GL_ARG_NONNULL is copied here. */ | ||
| 54 | |||
| 55 | /* The definition of _GL_WARN_ON_USE is copied here. */ | ||
| 56 | |||
| 57 | /* Before doing "#define mkdir rpl_mkdir" below, we need to include all | ||
| 58 | headers that may declare mkdir(). */ | ||
| 59 | #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | ||
| 60 | # include <io.h> /* mingw32, mingw64 */ | ||
| 61 | # include <direct.h> /* mingw64 */ | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #ifndef S_IFMT | ||
| 65 | # define S_IFMT 0170000 | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #if STAT_MACROS_BROKEN | ||
| 69 | # undef S_ISBLK | ||
| 70 | # undef S_ISCHR | ||
| 71 | # undef S_ISDIR | ||
| 72 | # undef S_ISFIFO | ||
| 73 | # undef S_ISLNK | ||
| 74 | # undef S_ISNAM | ||
| 75 | # undef S_ISMPB | ||
| 76 | # undef S_ISMPC | ||
| 77 | # undef S_ISNWK | ||
| 78 | # undef S_ISREG | ||
| 79 | # undef S_ISSOCK | ||
| 80 | #endif | ||
| 81 | |||
| 82 | #ifndef S_ISBLK | ||
| 83 | # ifdef S_IFBLK | ||
| 84 | # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | ||
| 85 | # else | ||
| 86 | # define S_ISBLK(m) 0 | ||
| 87 | # endif | ||
| 88 | #endif | ||
| 89 | |||
| 90 | #ifndef S_ISCHR | ||
| 91 | # ifdef S_IFCHR | ||
| 92 | # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | ||
| 93 | # else | ||
| 94 | # define S_ISCHR(m) 0 | ||
| 95 | # endif | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #ifndef S_ISDIR | ||
| 99 | # ifdef S_IFDIR | ||
| 100 | # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | ||
| 101 | # else | ||
| 102 | # define S_ISDIR(m) 0 | ||
| 103 | # endif | ||
| 104 | #endif | ||
| 105 | |||
| 106 | #ifndef S_ISDOOR /* Solaris 2.5 and up */ | ||
| 107 | # define S_ISDOOR(m) 0 | ||
| 108 | #endif | ||
| 109 | |||
| 110 | #ifndef S_ISFIFO | ||
| 111 | # ifdef S_IFIFO | ||
| 112 | # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | ||
| 113 | # else | ||
| 114 | # define S_ISFIFO(m) 0 | ||
| 115 | # endif | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #ifndef S_ISLNK | ||
| 119 | # ifdef S_IFLNK | ||
| 120 | # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | ||
| 121 | # else | ||
| 122 | # define S_ISLNK(m) 0 | ||
| 123 | # endif | ||
| 124 | #endif | ||
| 125 | |||
| 126 | #ifndef S_ISMPB /* V7 */ | ||
| 127 | # ifdef S_IFMPB | ||
| 128 | # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) | ||
| 129 | # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) | ||
| 130 | # else | ||
| 131 | # define S_ISMPB(m) 0 | ||
| 132 | # define S_ISMPC(m) 0 | ||
| 133 | # endif | ||
| 134 | #endif | ||
| 135 | |||
| 136 | #ifndef S_ISNAM /* Xenix */ | ||
| 137 | # ifdef S_IFNAM | ||
| 138 | # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) | ||
| 139 | # else | ||
| 140 | # define S_ISNAM(m) 0 | ||
| 141 | # endif | ||
| 142 | #endif | ||
| 143 | |||
| 144 | #ifndef S_ISNWK /* HP/UX */ | ||
| 145 | # ifdef S_IFNWK | ||
| 146 | # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) | ||
| 147 | # else | ||
| 148 | # define S_ISNWK(m) 0 | ||
| 149 | # endif | ||
| 150 | #endif | ||
| 151 | |||
| 152 | #ifndef S_ISPORT /* Solaris 10 and up */ | ||
| 153 | # define S_ISPORT(m) 0 | ||
| 154 | #endif | ||
| 155 | |||
| 156 | #ifndef S_ISREG | ||
| 157 | # ifdef S_IFREG | ||
| 158 | # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | ||
| 159 | # else | ||
| 160 | # define S_ISREG(m) 0 | ||
| 161 | # endif | ||
| 162 | #endif | ||
| 163 | |||
| 164 | #ifndef S_ISSOCK | ||
| 165 | # ifdef S_IFSOCK | ||
| 166 | # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | ||
| 167 | # else | ||
| 168 | # define S_ISSOCK(m) 0 | ||
| 169 | # endif | ||
| 170 | #endif | ||
| 171 | |||
| 172 | |||
| 173 | #ifndef S_TYPEISMQ | ||
| 174 | # define S_TYPEISMQ(p) 0 | ||
| 175 | #endif | ||
| 176 | |||
| 177 | #ifndef S_TYPEISTMO | ||
| 178 | # define S_TYPEISTMO(p) 0 | ||
| 179 | #endif | ||
| 180 | |||
| 181 | |||
| 182 | #ifndef S_TYPEISSEM | ||
| 183 | # ifdef S_INSEM | ||
| 184 | # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) | ||
| 185 | # else | ||
| 186 | # define S_TYPEISSEM(p) 0 | ||
| 187 | # endif | ||
| 188 | #endif | ||
| 189 | |||
| 190 | #ifndef S_TYPEISSHM | ||
| 191 | # ifdef S_INSHD | ||
| 192 | # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) | ||
| 193 | # else | ||
| 194 | # define S_TYPEISSHM(p) 0 | ||
| 195 | # endif | ||
| 196 | #endif | ||
| 197 | |||
| 198 | /* high performance ("contiguous data") */ | ||
| 199 | #ifndef S_ISCTG | ||
| 200 | # define S_ISCTG(p) 0 | ||
| 201 | #endif | ||
| 202 | |||
| 203 | /* Cray DMF (data migration facility): off line, with data */ | ||
| 204 | #ifndef S_ISOFD | ||
| 205 | # define S_ISOFD(p) 0 | ||
| 206 | #endif | ||
| 207 | |||
| 208 | /* Cray DMF (data migration facility): off line, with no data */ | ||
| 209 | #ifndef S_ISOFL | ||
| 210 | # define S_ISOFL(p) 0 | ||
| 211 | #endif | ||
| 212 | |||
| 213 | /* 4.4BSD whiteout */ | ||
| 214 | #ifndef S_ISWHT | ||
| 215 | # define S_ISWHT(m) 0 | ||
| 216 | #endif | ||
| 217 | |||
| 218 | /* If any of the following are undefined, | ||
| 219 | define them to their de facto standard values. */ | ||
| 220 | #if !S_ISUID | ||
| 221 | # define S_ISUID 04000 | ||
| 222 | #endif | ||
| 223 | #if !S_ISGID | ||
| 224 | # define S_ISGID 02000 | ||
| 225 | #endif | ||
| 226 | |||
| 227 | /* S_ISVTX is a common extension to POSIX. */ | ||
| 228 | #ifndef S_ISVTX | ||
| 229 | # define S_ISVTX 01000 | ||
| 230 | #endif | ||
| 231 | |||
| 232 | #if !S_IRUSR && S_IREAD | ||
| 233 | # define S_IRUSR S_IREAD | ||
| 234 | #endif | ||
| 235 | #if !S_IRUSR | ||
| 236 | # define S_IRUSR 00400 | ||
| 237 | #endif | ||
| 238 | #if !S_IRGRP | ||
| 239 | # define S_IRGRP (S_IRUSR >> 3) | ||
| 240 | #endif | ||
| 241 | #if !S_IROTH | ||
| 242 | # define S_IROTH (S_IRUSR >> 6) | ||
| 243 | #endif | ||
| 244 | |||
| 245 | #if !S_IWUSR && S_IWRITE | ||
| 246 | # define S_IWUSR S_IWRITE | ||
| 247 | #endif | ||
| 248 | #if !S_IWUSR | ||
| 249 | # define S_IWUSR 00200 | ||
| 250 | #endif | ||
| 251 | #if !S_IWGRP | ||
| 252 | # define S_IWGRP (S_IWUSR >> 3) | ||
| 253 | #endif | ||
| 254 | #if !S_IWOTH | ||
| 255 | # define S_IWOTH (S_IWUSR >> 6) | ||
| 256 | #endif | ||
| 257 | |||
| 258 | #if !S_IXUSR && S_IEXEC | ||
| 259 | # define S_IXUSR S_IEXEC | ||
| 260 | #endif | ||
| 261 | #if !S_IXUSR | ||
| 262 | # define S_IXUSR 00100 | ||
| 263 | #endif | ||
| 264 | #if !S_IXGRP | ||
| 265 | # define S_IXGRP (S_IXUSR >> 3) | ||
| 266 | #endif | ||
| 267 | #if !S_IXOTH | ||
| 268 | # define S_IXOTH (S_IXUSR >> 6) | ||
| 269 | #endif | ||
| 270 | |||
| 271 | #if !S_IRWXU | ||
| 272 | # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) | ||
| 273 | #endif | ||
| 274 | #if !S_IRWXG | ||
| 275 | # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) | ||
| 276 | #endif | ||
| 277 | #if !S_IRWXO | ||
| 278 | # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) | ||
| 279 | #endif | ||
| 280 | |||
| 281 | /* S_IXUGO is a common extension to POSIX. */ | ||
| 282 | #if !S_IXUGO | ||
| 283 | # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) | ||
| 284 | #endif | ||
| 285 | |||
| 286 | #ifndef S_IRWXUGO | ||
| 287 | # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) | ||
| 288 | #endif | ||
| 289 | |||
| 290 | /* Macros for futimens and utimensat. */ | ||
| 291 | #ifndef UTIME_NOW | ||
| 292 | # define UTIME_NOW (-1) | ||
| 293 | # define UTIME_OMIT (-2) | ||
| 294 | #endif | ||
| 295 | |||
| 296 | |||
| 297 | #if @GNULIB_FCHMODAT@ | ||
| 298 | # if !@HAVE_FCHMODAT@ | ||
| 299 | _GL_FUNCDECL_SYS (fchmodat, int, | ||
| 300 | (int fd, char const *file, mode_t mode, int flag) | ||
| 301 | _GL_ARG_NONNULL ((2))); | ||
| 302 | # endif | ||
| 303 | _GL_CXXALIAS_SYS (fchmodat, int, | ||
| 304 | (int fd, char const *file, mode_t mode, int flag)); | ||
| 305 | _GL_CXXALIASWARN (fchmodat); | ||
| 306 | #elif defined GNULIB_POSIXCHECK | ||
| 307 | # undef fchmodat | ||
| 308 | # if HAVE_RAW_DECL_FCHMODAT | ||
| 309 | _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " | ||
| 310 | "use gnulib module openat for portability"); | ||
| 311 | # endif | ||
| 312 | #endif | ||
| 313 | |||
| 314 | |||
| 315 | #if @REPLACE_FSTAT@ | ||
| 316 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 317 | # define fstat rpl_fstat | ||
| 318 | # endif | ||
| 319 | _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); | ||
| 320 | _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); | ||
| 321 | #else | ||
| 322 | _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); | ||
| 323 | #endif | ||
| 324 | _GL_CXXALIASWARN (fstat); | ||
| 325 | |||
| 326 | |||
| 327 | #if @GNULIB_FSTATAT@ | ||
| 328 | # if @REPLACE_FSTATAT@ | ||
| 329 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 330 | # undef fstatat | ||
| 331 | # define fstatat rpl_fstatat | ||
| 332 | # endif | ||
| 333 | _GL_FUNCDECL_RPL (fstatat, int, | ||
| 334 | (int fd, char const *name, struct stat *st, int flags) | ||
| 335 | _GL_ARG_NONNULL ((2, 3))); | ||
| 336 | _GL_CXXALIAS_RPL (fstatat, int, | ||
| 337 | (int fd, char const *name, struct stat *st, int flags)); | ||
| 338 | # else | ||
| 339 | # if !@HAVE_FSTATAT@ | ||
| 340 | _GL_FUNCDECL_SYS (fstatat, int, | ||
| 341 | (int fd, char const *name, struct stat *st, int flags) | ||
| 342 | _GL_ARG_NONNULL ((2, 3))); | ||
| 343 | # endif | ||
| 344 | _GL_CXXALIAS_SYS (fstatat, int, | ||
| 345 | (int fd, char const *name, struct stat *st, int flags)); | ||
| 346 | # endif | ||
| 347 | _GL_CXXALIASWARN (fstatat); | ||
| 348 | #elif defined GNULIB_POSIXCHECK | ||
| 349 | # undef fstatat | ||
| 350 | # if HAVE_RAW_DECL_FSTATAT | ||
| 351 | _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " | ||
| 352 | "use gnulib module openat for portability"); | ||
| 353 | # endif | ||
| 354 | #endif | ||
| 355 | |||
| 356 | |||
| 357 | #if @GNULIB_FUTIMENS@ | ||
| 358 | # if @REPLACE_FUTIMENS@ | ||
| 359 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 360 | # undef futimens | ||
| 361 | # define futimens rpl_futimens | ||
| 362 | # endif | ||
| 363 | _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); | ||
| 364 | _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); | ||
| 365 | # else | ||
| 366 | # if !@HAVE_FUTIMENS@ | ||
| 367 | _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); | ||
| 368 | # endif | ||
| 369 | _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); | ||
| 370 | # endif | ||
| 371 | _GL_CXXALIASWARN (futimens); | ||
| 372 | #elif defined GNULIB_POSIXCHECK | ||
| 373 | # undef futimens | ||
| 374 | # if HAVE_RAW_DECL_FUTIMENS | ||
| 375 | _GL_WARN_ON_USE (futimens, "futimens is not portable - " | ||
| 376 | "use gnulib module futimens for portability"); | ||
| 377 | # endif | ||
| 378 | #endif | ||
| 379 | |||
| 380 | |||
| 381 | #if @GNULIB_LCHMOD@ | ||
| 382 | /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME | ||
| 383 | denotes a symbolic link. */ | ||
| 384 | # if !@HAVE_LCHMOD@ | ||
| 385 | /* The lchmod replacement follows symbolic links. Callers should take | ||
| 386 | this into account; lchmod should be applied only to arguments that | ||
| 387 | are known to not be symbolic links. On hosts that lack lchmod, | ||
| 388 | this can lead to race conditions between the check and the | ||
| 389 | invocation of lchmod, but we know of no workarounds that are | ||
| 390 | reliable in general. You might try requesting support for lchmod | ||
| 391 | from your operating system supplier. */ | ||
| 392 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 393 | # define lchmod chmod | ||
| 394 | # endif | ||
| 395 | /* Need to cast, because on mingw, the second parameter of chmod is | ||
| 396 | int mode. */ | ||
| 397 | _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, | ||
| 398 | (const char *filename, mode_t mode)); | ||
| 399 | # else | ||
| 400 | # if 0 /* assume already declared */ | ||
| 401 | _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) | ||
| 402 | _GL_ARG_NONNULL ((1))); | ||
| 403 | # endif | ||
| 404 | _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); | ||
| 405 | # endif | ||
| 406 | # if @HAVE_LCHMOD@ | ||
| 407 | _GL_CXXALIASWARN (lchmod); | ||
| 408 | # endif | ||
| 409 | #elif defined GNULIB_POSIXCHECK | ||
| 410 | # undef lchmod | ||
| 411 | # if HAVE_RAW_DECL_LCHMOD | ||
| 412 | _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " | ||
| 413 | "use gnulib module lchmod for portability"); | ||
| 414 | # endif | ||
| 415 | #endif | ||
| 416 | |||
| 417 | |||
| 418 | #if @GNULIB_LSTAT@ | ||
| 419 | # if ! @HAVE_LSTAT@ | ||
| 420 | /* mingw does not support symlinks, therefore it does not have lstat. But | ||
| 421 | without links, stat does just fine. */ | ||
| 422 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 423 | # define lstat stat | ||
| 424 | # endif | ||
| 425 | _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf)); | ||
| 426 | # elif @REPLACE_LSTAT@ | ||
| 427 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 428 | # undef lstat | ||
| 429 | # define lstat rpl_lstat | ||
| 430 | # endif | ||
| 431 | _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf) | ||
| 432 | _GL_ARG_NONNULL ((1, 2))); | ||
| 433 | _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf)); | ||
| 434 | # else | ||
| 435 | _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); | ||
| 436 | # endif | ||
| 437 | # if @HAVE_LSTAT@ | ||
| 438 | _GL_CXXALIASWARN (lstat); | ||
| 439 | # endif | ||
| 440 | #elif defined GNULIB_POSIXCHECK | ||
| 441 | # undef lstat | ||
| 442 | # if HAVE_RAW_DECL_LSTAT | ||
| 443 | _GL_WARN_ON_USE (lstat, "lstat is unportable - " | ||
| 444 | "use gnulib module lstat for portability"); | ||
| 445 | # endif | ||
| 446 | #endif | ||
| 447 | |||
| 448 | |||
| 449 | #if @REPLACE_MKDIR@ | ||
| 450 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 451 | # undef mkdir | ||
| 452 | # define mkdir rpl_mkdir | ||
| 453 | # endif | ||
| 454 | _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) | ||
| 455 | _GL_ARG_NONNULL ((1))); | ||
| 456 | _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); | ||
| 457 | #else | ||
| 458 | /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. | ||
| 459 | Additionally, it declares _mkdir (and depending on compile flags, an | ||
| 460 | alias mkdir), only in the nonstandard includes <direct.h> and <io.h>, | ||
| 461 | which are included above. */ | ||
| 462 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | ||
| 463 | |||
| 464 | # if !GNULIB_defined_rpl_mkdir | ||
| 465 | static inline int | ||
| 466 | rpl_mkdir (char const *name, mode_t mode) | ||
| 467 | { | ||
| 468 | return _mkdir (name); | ||
| 469 | } | ||
| 470 | # define GNULIB_defined_rpl_mkdir 1 | ||
| 471 | # endif | ||
| 472 | |||
| 473 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 474 | # define mkdir rpl_mkdir | ||
| 475 | # endif | ||
| 476 | _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); | ||
| 477 | # else | ||
| 478 | _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); | ||
| 479 | # endif | ||
| 480 | #endif | ||
| 481 | _GL_CXXALIASWARN (mkdir); | ||
| 482 | |||
| 483 | |||
| 484 | #if @GNULIB_MKDIRAT@ | ||
| 485 | # if !@HAVE_MKDIRAT@ | ||
| 486 | _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) | ||
| 487 | _GL_ARG_NONNULL ((2))); | ||
| 488 | # endif | ||
| 489 | _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); | ||
| 490 | _GL_CXXALIASWARN (mkdirat); | ||
| 491 | #elif defined GNULIB_POSIXCHECK | ||
| 492 | # undef mkdirat | ||
| 493 | # if HAVE_RAW_DECL_MKDIRAT | ||
| 494 | _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " | ||
| 495 | "use gnulib module openat for portability"); | ||
| 496 | # endif | ||
| 497 | #endif | ||
| 498 | |||
| 499 | |||
| 500 | #if @GNULIB_MKFIFO@ | ||
| 501 | # if @REPLACE_MKFIFO@ | ||
| 502 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 503 | # undef mkfifo | ||
| 504 | # define mkfifo rpl_mkfifo | ||
| 505 | # endif | ||
| 506 | _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) | ||
| 507 | _GL_ARG_NONNULL ((1))); | ||
| 508 | _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); | ||
| 509 | # else | ||
| 510 | # if !@HAVE_MKFIFO@ | ||
| 511 | _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) | ||
| 512 | _GL_ARG_NONNULL ((1))); | ||
| 513 | # endif | ||
| 514 | _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); | ||
| 515 | # endif | ||
| 516 | _GL_CXXALIASWARN (mkfifo); | ||
| 517 | #elif defined GNULIB_POSIXCHECK | ||
| 518 | # undef mkfifo | ||
| 519 | # if HAVE_RAW_DECL_MKFIFO | ||
| 520 | _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " | ||
| 521 | "use gnulib module mkfifo for portability"); | ||
| 522 | # endif | ||
| 523 | #endif | ||
| 524 | |||
| 525 | |||
| 526 | #if @GNULIB_MKFIFOAT@ | ||
| 527 | # if !@HAVE_MKFIFOAT@ | ||
| 528 | _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) | ||
| 529 | _GL_ARG_NONNULL ((2))); | ||
| 530 | # endif | ||
| 531 | _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); | ||
| 532 | _GL_CXXALIASWARN (mkfifoat); | ||
| 533 | #elif defined GNULIB_POSIXCHECK | ||
| 534 | # undef mkfifoat | ||
| 535 | # if HAVE_RAW_DECL_MKFIFOAT | ||
| 536 | _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " | ||
| 537 | "use gnulib module mkfifoat for portability"); | ||
| 538 | # endif | ||
| 539 | #endif | ||
| 540 | |||
| 541 | |||
| 542 | #if @GNULIB_MKNOD@ | ||
| 543 | # if @REPLACE_MKNOD@ | ||
| 544 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 545 | # undef mknod | ||
| 546 | # define mknod rpl_mknod | ||
| 547 | # endif | ||
| 548 | _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) | ||
| 549 | _GL_ARG_NONNULL ((1))); | ||
| 550 | _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); | ||
| 551 | # else | ||
| 552 | # if !@HAVE_MKNOD@ | ||
| 553 | _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) | ||
| 554 | _GL_ARG_NONNULL ((1))); | ||
| 555 | # endif | ||
| 556 | /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ | ||
| 557 | _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); | ||
| 558 | # endif | ||
| 559 | _GL_CXXALIASWARN (mknod); | ||
| 560 | #elif defined GNULIB_POSIXCHECK | ||
| 561 | # undef mknod | ||
| 562 | # if HAVE_RAW_DECL_MKNOD | ||
| 563 | _GL_WARN_ON_USE (mknod, "mknod is not portable - " | ||
| 564 | "use gnulib module mknod for portability"); | ||
| 565 | # endif | ||
| 566 | #endif | ||
| 567 | |||
| 568 | |||
| 569 | #if @GNULIB_MKNODAT@ | ||
| 570 | # if !@HAVE_MKNODAT@ | ||
| 571 | _GL_FUNCDECL_SYS (mknodat, int, | ||
| 572 | (int fd, char const *file, mode_t mode, dev_t dev) | ||
| 573 | _GL_ARG_NONNULL ((2))); | ||
| 574 | # endif | ||
| 575 | _GL_CXXALIAS_SYS (mknodat, int, | ||
| 576 | (int fd, char const *file, mode_t mode, dev_t dev)); | ||
| 577 | _GL_CXXALIASWARN (mknodat); | ||
| 578 | #elif defined GNULIB_POSIXCHECK | ||
| 579 | # undef mknodat | ||
| 580 | # if HAVE_RAW_DECL_MKNODAT | ||
| 581 | _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " | ||
| 582 | "use gnulib module mkfifoat for portability"); | ||
| 583 | # endif | ||
| 584 | #endif | ||
| 585 | |||
| 586 | |||
| 587 | #if @GNULIB_STAT@ | ||
| 588 | # if @REPLACE_STAT@ | ||
| 589 | /* We can't use the object-like #define stat rpl_stat, because of | ||
| 590 | struct stat. This means that rpl_stat will not be used if the user | ||
| 591 | does (stat)(a,b). Oh well. */ | ||
| 592 | # undef stat | ||
| 593 | # ifdef _LARGE_FILES | ||
| 594 | /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, | ||
| 595 | so we have to replace stat64() instead of stat(). */ | ||
| 596 | # define stat stat64 | ||
| 597 | # undef stat64 | ||
| 598 | # define stat64(name, st) rpl_stat (name, st) | ||
| 599 | # else /* !_LARGE_FILES */ | ||
| 600 | # define stat(name, st) rpl_stat (name, st) | ||
| 601 | # endif /* !_LARGE_FILES */ | ||
| 602 | _GL_EXTERN_C int stat (const char *name, struct stat *buf) | ||
| 603 | _GL_ARG_NONNULL ((1, 2)); | ||
| 604 | # endif | ||
| 605 | #elif defined GNULIB_POSIXCHECK | ||
| 606 | # undef stat | ||
| 607 | # if HAVE_RAW_DECL_STAT | ||
| 608 | _GL_WARN_ON_USE (stat, "stat is unportable - " | ||
| 609 | "use gnulib module stat for portability"); | ||
| 610 | # endif | ||
| 611 | #endif | ||
| 612 | |||
| 613 | |||
| 614 | #if @GNULIB_UTIMENSAT@ | ||
| 615 | # if @REPLACE_UTIMENSAT@ | ||
| 616 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 617 | # undef utimensat | ||
| 618 | # define utimensat rpl_utimensat | ||
| 619 | # endif | ||
| 620 | _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, | ||
| 621 | struct timespec const times[2], int flag) | ||
| 622 | _GL_ARG_NONNULL ((2))); | ||
| 623 | _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, | ||
| 624 | struct timespec const times[2], int flag)); | ||
| 625 | # else | ||
| 626 | # if !@HAVE_UTIMENSAT@ | ||
| 627 | _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, | ||
| 628 | struct timespec const times[2], int flag) | ||
| 629 | _GL_ARG_NONNULL ((2))); | ||
| 630 | # endif | ||
| 631 | _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, | ||
| 632 | struct timespec const times[2], int flag)); | ||
| 633 | # endif | ||
| 634 | _GL_CXXALIASWARN (utimensat); | ||
| 635 | #elif defined GNULIB_POSIXCHECK | ||
| 636 | # undef utimensat | ||
| 637 | # if HAVE_RAW_DECL_UTIMENSAT | ||
| 638 | _GL_WARN_ON_USE (utimensat, "utimensat is not portable - " | ||
| 639 | "use gnulib module utimensat for portability"); | ||
| 640 | # endif | ||
| 641 | #endif | ||
| 642 | |||
| 643 | |||
| 644 | #endif /* _GL_SYS_STAT_H */ | ||
| 645 | #endif /* _GL_SYS_STAT_H */ | ||
| 646 | #endif | ||
diff --git a/lisp/emacs-lisp/find-gc.el b/lisp/emacs-lisp/find-gc.el index 773b8f11408..1de38625243 100644 --- a/lisp/emacs-lisp/find-gc.el +++ b/lisp/emacs-lisp/find-gc.el | |||
| @@ -55,7 +55,7 @@ Each entry has the form (FUNCTION . FUNCTIONS-IT-CALLS).") | |||
| 55 | "term.c" "cm.c" "emacs.c" "keyboard.c" "macros.c" | 55 | "term.c" "cm.c" "emacs.c" "keyboard.c" "macros.c" |
| 56 | "keymap.c" "sysdep.c" "buffer.c" "filelock.c" | 56 | "keymap.c" "sysdep.c" "buffer.c" "filelock.c" |
| 57 | "insdel.c" "marker.c" "minibuf.c" "fileio.c" | 57 | "insdel.c" "marker.c" "minibuf.c" "fileio.c" |
| 58 | "dired.c" "filemode.c" "cmds.c" "casefiddle.c" | 58 | "dired.c" "cmds.c" "casefiddle.c" |
| 59 | "indent.c" "search.c" "regex.c" "undo.c" | 59 | "indent.c" "search.c" "regex.c" "undo.c" |
| 60 | "alloc.c" "data.c" "doc.c" "editfns.c" | 60 | "alloc.c" "data.c" "doc.c" "editfns.c" |
| 61 | "callint.c" "eval.c" "fns.c" "print.c" "lread.c" | 61 | "callint.c" "eval.c" "fns.c" "print.c" "lread.c" |
diff --git a/m4/filemode.m4 b/m4/filemode.m4 new file mode 100644 index 00000000000..4147fd01e28 --- /dev/null +++ b/m4/filemode.m4 | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | # filemode.m4 serial 7 | ||
| 2 | dnl Copyright (C) 2002, 2005-2006, 2009-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FILEMODE], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([AC_STRUCT_ST_DM_MODE]) | ||
| 10 | AC_LIBOBJ([filemode]) | ||
| 11 | AC_CHECK_DECLS_ONCE([strmode]) | ||
| 12 | ]) | ||
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4 index 43ff36558b5..10ec34da386 100644 --- a/m4/gl-comp.m4 +++ b/m4/gl-comp.m4 | |||
| @@ -32,6 +32,7 @@ AC_DEFUN([gl_EARLY], | |||
| 32 | # Code from module dtoastr: | 32 | # Code from module dtoastr: |
| 33 | # Code from module extensions: | 33 | # Code from module extensions: |
| 34 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 34 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
| 35 | # Code from module filemode: | ||
| 35 | # Code from module getloadavg: | 36 | # Code from module getloadavg: |
| 36 | # Code from module getopt-gnu: | 37 | # Code from module getopt-gnu: |
| 37 | # Code from module getopt-posix: | 38 | # Code from module getopt-posix: |
| @@ -46,6 +47,7 @@ AC_DEFUN([gl_EARLY], | |||
| 46 | # Code from module stdint: | 47 | # Code from module stdint: |
| 47 | # Code from module stdlib: | 48 | # Code from module stdlib: |
| 48 | # Code from module strftime: | 49 | # Code from module strftime: |
| 50 | # Code from module sys_stat: | ||
| 49 | # Code from module time: | 51 | # Code from module time: |
| 50 | # Code from module time_r: | 52 | # Code from module time_r: |
| 51 | # Code from module unistd: | 53 | # Code from module unistd: |
| @@ -75,6 +77,8 @@ AC_DEFUN([gl_INIT], | |||
| 75 | # Code from module dtoastr: | 77 | # Code from module dtoastr: |
| 76 | AC_REQUIRE([gl_C99_STRTOLD]) | 78 | AC_REQUIRE([gl_C99_STRTOLD]) |
| 77 | # Code from module extensions: | 79 | # Code from module extensions: |
| 80 | # Code from module filemode: | ||
| 81 | gl_FILEMODE | ||
| 78 | # Code from module getloadavg: | 82 | # Code from module getloadavg: |
| 79 | gl_GETLOADAVG([$gl_source_base]) | 83 | gl_GETLOADAVG([$gl_source_base]) |
| 80 | gl_STDLIB_MODULE_INDICATOR([getloadavg]) | 84 | gl_STDLIB_MODULE_INDICATOR([getloadavg]) |
| @@ -105,6 +109,9 @@ AC_DEFUN([gl_INIT], | |||
| 105 | gl_STDLIB_H | 109 | gl_STDLIB_H |
| 106 | # Code from module strftime: | 110 | # Code from module strftime: |
| 107 | gl_FUNC_GNU_STRFTIME | 111 | gl_FUNC_GNU_STRFTIME |
| 112 | # Code from module sys_stat: | ||
| 113 | gl_HEADER_SYS_STAT_H | ||
| 114 | AC_PROG_MKDIR_P | ||
| 108 | # Code from module time: | 115 | # Code from module time: |
| 109 | gl_HEADER_TIME_H | 116 | gl_HEADER_TIME_H |
| 110 | # Code from module time_r: | 117 | # Code from module time_r: |
| @@ -257,6 +264,8 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 257 | build-aux/c++defs.h | 264 | build-aux/c++defs.h |
| 258 | build-aux/warn-on-use.h | 265 | build-aux/warn-on-use.h |
| 259 | lib/dtoastr.c | 266 | lib/dtoastr.c |
| 267 | lib/filemode.c | ||
| 268 | lib/filemode.h | ||
| 260 | lib/ftoastr.c | 269 | lib/ftoastr.c |
| 261 | lib/ftoastr.h | 270 | lib/ftoastr.h |
| 262 | lib/getloadavg.c | 271 | lib/getloadavg.c |
| @@ -277,12 +286,14 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 277 | lib/stdlib.in.h | 286 | lib/stdlib.in.h |
| 278 | lib/strftime.c | 287 | lib/strftime.c |
| 279 | lib/strftime.h | 288 | lib/strftime.h |
| 289 | lib/sys_stat.in.h | ||
| 280 | lib/time.in.h | 290 | lib/time.in.h |
| 281 | lib/time_r.c | 291 | lib/time_r.c |
| 282 | lib/unistd.in.h | 292 | lib/unistd.in.h |
| 283 | m4/00gnulib.m4 | 293 | m4/00gnulib.m4 |
| 284 | m4/c-strtod.m4 | 294 | m4/c-strtod.m4 |
| 285 | m4/extensions.m4 | 295 | m4/extensions.m4 |
| 296 | m4/filemode.m4 | ||
| 286 | m4/getloadavg.m4 | 297 | m4/getloadavg.m4 |
| 287 | m4/getopt.m4 | 298 | m4/getopt.m4 |
| 288 | m4/gnulib-common.m4 | 299 | m4/gnulib-common.m4 |
| @@ -291,11 +302,13 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 291 | m4/md5.m4 | 302 | m4/md5.m4 |
| 292 | m4/mktime.m4 | 303 | m4/mktime.m4 |
| 293 | m4/multiarch.m4 | 304 | m4/multiarch.m4 |
| 305 | m4/st_dm_mode.m4 | ||
| 294 | m4/stdbool.m4 | 306 | m4/stdbool.m4 |
| 295 | m4/stddef_h.m4 | 307 | m4/stddef_h.m4 |
| 296 | m4/stdint.m4 | 308 | m4/stdint.m4 |
| 297 | m4/stdlib_h.m4 | 309 | m4/stdlib_h.m4 |
| 298 | m4/strftime.m4 | 310 | m4/strftime.m4 |
| 311 | m4/sys_stat_h.m4 | ||
| 299 | m4/time_h.m4 | 312 | m4/time_h.m4 |
| 300 | m4/time_r.m4 | 313 | m4/time_r.m4 |
| 301 | m4/tm_gmtoff.m4 | 314 | m4/tm_gmtoff.m4 |
diff --git a/m4/st_dm_mode.m4 b/m4/st_dm_mode.m4 new file mode 100644 index 00000000000..84f74638f12 --- /dev/null +++ b/m4/st_dm_mode.m4 | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | # serial 6 | ||
| 2 | |||
| 3 | # Copyright (C) 1998-1999, 2001, 2009-2011 Free Software Foundation, Inc. | ||
| 4 | # This file is free software; the Free Software Foundation | ||
| 5 | # gives unlimited permission to copy and/or distribute it, | ||
| 6 | # with or without modifications, as long as this notice is preserved. | ||
| 7 | |||
| 8 | # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member. | ||
| 9 | |||
| 10 | AC_DEFUN([AC_STRUCT_ST_DM_MODE], | ||
| 11 | [AC_CACHE_CHECK([for st_dm_mode in struct stat], [ac_cv_struct_st_dm_mode], | ||
| 12 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
| 13 | #include <sys/types.h> | ||
| 14 | #include <sys/stat.h>]], [[struct stat s; s.st_dm_mode;]])], | ||
| 15 | [ac_cv_struct_st_dm_mode=yes], | ||
| 16 | [ac_cv_struct_st_dm_mode=no])]) | ||
| 17 | |||
| 18 | if test $ac_cv_struct_st_dm_mode = yes; then | ||
| 19 | AC_DEFINE([HAVE_ST_DM_MODE], [1], | ||
| 20 | [Define if struct stat has an st_dm_mode member. ]) | ||
| 21 | fi | ||
| 22 | ] | ||
| 23 | ) | ||
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 new file mode 100644 index 00000000000..fc419129e98 --- /dev/null +++ b/m4/sys_stat_h.m4 | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | # sys_stat_h.m4 serial 24 -*- Autoconf -*- | ||
| 2 | dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Eric Blake. | ||
| 8 | dnl Provide a GNU-like <sys/stat.h>. | ||
| 9 | |||
| 10 | AC_DEFUN([gl_HEADER_SYS_STAT_H], | ||
| 11 | [ | ||
| 12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
| 13 | |||
| 14 | dnl For the mkdir substitute. | ||
| 15 | AC_REQUIRE([AC_C_INLINE]) | ||
| 16 | |||
| 17 | dnl Check for broken stat macros. | ||
| 18 | AC_REQUIRE([AC_HEADER_STAT]) | ||
| 19 | |||
| 20 | gl_CHECK_NEXT_HEADERS([sys/stat.h]) | ||
| 21 | |||
| 22 | dnl Define types that are supposed to be defined in <sys/types.h> or | ||
| 23 | dnl <sys/stat.h>. | ||
| 24 | AC_CHECK_TYPE([nlink_t], [], | ||
| 25 | [AC_DEFINE([nlink_t], [int], | ||
| 26 | [Define to the type of st_nlink in struct stat, or a supertype.])], | ||
| 27 | [#include <sys/types.h> | ||
| 28 | #include <sys/stat.h>]) | ||
| 29 | |||
| 30 | dnl Check for declarations of anything we want to poison if the | ||
| 31 | dnl corresponding gnulib module is not in use. | ||
| 32 | gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> | ||
| 33 | ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat | ||
| 34 | mknod mknodat stat utimensat]) | ||
| 35 | ]) # gl_HEADER_SYS_STAT_H | ||
| 36 | |||
| 37 | AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], | ||
| 38 | [ | ||
| 39 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | ||
| 40 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
| 41 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 42 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 43 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 44 | ]) | ||
| 45 | |||
| 46 | AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], | ||
| 47 | [ | ||
| 48 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR | ||
| 49 | GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) | ||
| 50 | GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) | ||
| 51 | GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) | ||
| 52 | GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) | ||
| 53 | GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) | ||
| 54 | GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) | ||
| 55 | GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) | ||
| 56 | GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) | ||
| 57 | GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) | ||
| 58 | GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) | ||
| 59 | GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) | ||
| 60 | GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) | ||
| 61 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 62 | HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) | ||
| 63 | HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) | ||
| 64 | HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) | ||
| 65 | HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) | ||
| 66 | HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) | ||
| 67 | HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) | ||
| 68 | HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) | ||
| 69 | HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) | ||
| 70 | HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) | ||
| 71 | HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) | ||
| 72 | HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) | ||
| 73 | REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) | ||
| 74 | REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) | ||
| 75 | REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) | ||
| 76 | REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) | ||
| 77 | REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) | ||
| 78 | REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) | ||
| 79 | REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) | ||
| 80 | REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) | ||
| 81 | REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) | ||
| 82 | ]) | ||
diff --git a/src/filemode.c b/src/filemode.c deleted file mode 100644 index d41cd56c569..00000000000 --- a/src/filemode.c +++ /dev/null | |||
| @@ -1,245 +0,0 @@ | |||
| 1 | /* filemode.c -- make a string describing file modes | ||
| 2 | Copyright (C) 1985, 1990, 1993, 2001-2011 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, write to the Free Software | ||
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
| 17 | USA. */ | ||
| 18 | |||
| 19 | #include <config.h> | ||
| 20 | #include <sys/types.h> | ||
| 21 | #include <sys/stat.h> | ||
| 22 | |||
| 23 | #if !S_IRUSR | ||
| 24 | # if S_IREAD | ||
| 25 | # define S_IRUSR S_IREAD | ||
| 26 | # else | ||
| 27 | # define S_IRUSR 00400 | ||
| 28 | # endif | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #if !S_IWUSR | ||
| 32 | # if S_IWRITE | ||
| 33 | # define S_IWUSR S_IWRITE | ||
| 34 | # else | ||
| 35 | # define S_IWUSR 00200 | ||
| 36 | # endif | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #if !S_IXUSR | ||
| 40 | # if S_IEXEC | ||
| 41 | # define S_IXUSR S_IEXEC | ||
| 42 | # else | ||
| 43 | # define S_IXUSR 00100 | ||
| 44 | # endif | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifdef STAT_MACROS_BROKEN | ||
| 48 | #undef S_ISBLK | ||
| 49 | #undef S_ISCHR | ||
| 50 | #undef S_ISDIR | ||
| 51 | #undef S_ISFIFO | ||
| 52 | #undef S_ISLNK | ||
| 53 | #undef S_ISMPB | ||
| 54 | #undef S_ISMPC | ||
| 55 | #undef S_ISNWK | ||
| 56 | #undef S_ISREG | ||
| 57 | #undef S_ISSOCK | ||
| 58 | #endif /* STAT_MACROS_BROKEN. */ | ||
| 59 | |||
| 60 | #if !defined(S_ISBLK) && defined(S_IFBLK) | ||
| 61 | #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | ||
| 62 | #endif | ||
| 63 | #if !defined(S_ISCHR) && defined(S_IFCHR) | ||
| 64 | #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | ||
| 65 | #endif | ||
| 66 | #if !defined(S_ISDIR) && defined(S_IFDIR) | ||
| 67 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | ||
| 68 | #endif | ||
| 69 | #if !defined(S_ISREG) && defined(S_IFREG) | ||
| 70 | #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | ||
| 71 | #endif | ||
| 72 | #if !defined(S_ISFIFO) && defined(S_IFIFO) | ||
| 73 | #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | ||
| 74 | #endif | ||
| 75 | #if !defined(S_ISLNK) && defined(S_IFLNK) | ||
| 76 | #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | ||
| 77 | #endif | ||
| 78 | #if !defined(S_ISSOCK) && defined(S_IFSOCK) | ||
| 79 | #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | ||
| 80 | #endif | ||
| 81 | #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */ | ||
| 82 | #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) | ||
| 83 | #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) | ||
| 84 | #endif | ||
| 85 | #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */ | ||
| 86 | #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) | ||
| 87 | #endif | ||
| 88 | |||
| 89 | void mode_string (short unsigned int mode, char *str); | ||
| 90 | static char ftypelet (long int bits); | ||
| 91 | static void rwx (short unsigned int bits, char *chars); | ||
| 92 | static void setst (short unsigned int bits, char *chars); | ||
| 93 | |||
| 94 | /* filemodestring - fill in string STR with an ls-style ASCII | ||
| 95 | representation of the st_mode field of file stats block STATP. | ||
| 96 | 10 characters are stored in STR; no terminating null is added. | ||
| 97 | The characters stored in STR are: | ||
| 98 | |||
| 99 | 0 File type. 'd' for directory, 'c' for character | ||
| 100 | special, 'b' for block special, 'm' for multiplex, | ||
| 101 | 'l' for symbolic link, 's' for socket, 'p' for fifo, | ||
| 102 | '-' for regular, '?' for any other file type | ||
| 103 | |||
| 104 | 1 'r' if the owner may read, '-' otherwise. | ||
| 105 | |||
| 106 | 2 'w' if the owner may write, '-' otherwise. | ||
| 107 | |||
| 108 | 3 'x' if the owner may execute, 's' if the file is | ||
| 109 | set-user-id, '-' otherwise. | ||
| 110 | 'S' if the file is set-user-id, but the execute | ||
| 111 | bit isn't set. | ||
| 112 | |||
| 113 | 4 'r' if group members may read, '-' otherwise. | ||
| 114 | |||
| 115 | 5 'w' if group members may write, '-' otherwise. | ||
| 116 | |||
| 117 | 6 'x' if group members may execute, 's' if the file is | ||
| 118 | set-group-id, '-' otherwise. | ||
| 119 | 'S' if it is set-group-id but not executable. | ||
| 120 | |||
| 121 | 7 'r' if any user may read, '-' otherwise. | ||
| 122 | |||
| 123 | 8 'w' if any user may write, '-' otherwise. | ||
| 124 | |||
| 125 | 9 'x' if any user may execute, 't' if the file is "sticky" | ||
| 126 | (will be retained in swap space after execution), '-' | ||
| 127 | otherwise. | ||
| 128 | 'T' if the file is sticky but not executable. */ | ||
| 129 | |||
| 130 | void | ||
| 131 | filemodestring (struct stat *statp, char *str) | ||
| 132 | { | ||
| 133 | mode_string (statp->st_mode, str); | ||
| 134 | } | ||
| 135 | |||
| 136 | /* Like filemodestring, but only the relevant part of the `struct stat' | ||
| 137 | is given as an argument. */ | ||
| 138 | |||
| 139 | void | ||
| 140 | mode_string (short unsigned int mode, char *str) | ||
| 141 | { | ||
| 142 | str[0] = ftypelet ((long) mode); | ||
| 143 | rwx ((mode & 0700) << 0, &str[1]); | ||
| 144 | rwx ((mode & 0070) << 3, &str[4]); | ||
| 145 | rwx ((mode & 0007) << 6, &str[7]); | ||
| 146 | setst (mode, str); | ||
| 147 | } | ||
| 148 | |||
| 149 | /* Return a character indicating the type of file described by | ||
| 150 | file mode BITS: | ||
| 151 | 'd' for directories | ||
| 152 | 'b' for block special files | ||
| 153 | 'c' for character special files | ||
| 154 | 'm' for multiplexor files | ||
| 155 | 'l' for symbolic links | ||
| 156 | 's' for sockets | ||
| 157 | 'p' for fifos | ||
| 158 | '-' for regular files | ||
| 159 | '?' for any other file type. */ | ||
| 160 | |||
| 161 | static char | ||
| 162 | ftypelet (long int bits) | ||
| 163 | { | ||
| 164 | #ifdef S_ISBLK | ||
| 165 | if (S_ISBLK (bits)) | ||
| 166 | return 'b'; | ||
| 167 | #endif | ||
| 168 | if (S_ISCHR (bits)) | ||
| 169 | return 'c'; | ||
| 170 | if (S_ISDIR (bits)) | ||
| 171 | return 'd'; | ||
| 172 | if (S_ISREG (bits)) | ||
| 173 | return '-'; | ||
| 174 | #ifdef S_ISFIFO | ||
| 175 | if (S_ISFIFO (bits)) | ||
| 176 | return 'p'; | ||
| 177 | #endif | ||
| 178 | #ifdef S_ISLNK | ||
| 179 | if (S_ISLNK (bits)) | ||
| 180 | return 'l'; | ||
| 181 | #endif | ||
| 182 | #ifdef S_ISSOCK | ||
| 183 | if (S_ISSOCK (bits)) | ||
| 184 | return 's'; | ||
| 185 | #endif | ||
| 186 | #ifdef S_ISMPC | ||
| 187 | if (S_ISMPC (bits)) | ||
| 188 | return 'm'; | ||
| 189 | #endif | ||
| 190 | #ifdef S_ISNWK | ||
| 191 | if (S_ISNWK (bits)) | ||
| 192 | return 'n'; | ||
| 193 | #endif | ||
| 194 | return '?'; | ||
| 195 | } | ||
| 196 | |||
| 197 | /* Look at read, write, and execute bits in BITS and set | ||
| 198 | flags in CHARS accordingly. */ | ||
| 199 | |||
| 200 | static void | ||
| 201 | rwx (short unsigned int bits, char *chars) | ||
| 202 | { | ||
| 203 | chars[0] = (bits & S_IRUSR) ? 'r' : '-'; | ||
| 204 | chars[1] = (bits & S_IWUSR) ? 'w' : '-'; | ||
| 205 | chars[2] = (bits & S_IXUSR) ? 'x' : '-'; | ||
| 206 | } | ||
| 207 | |||
| 208 | /* Set the 's' and 't' flags in file attributes string CHARS, | ||
| 209 | according to the file mode BITS. */ | ||
| 210 | |||
| 211 | static void | ||
| 212 | setst (short unsigned int bits, char *chars) | ||
| 213 | { | ||
| 214 | #ifdef S_ISUID | ||
| 215 | if (bits & S_ISUID) | ||
| 216 | { | ||
| 217 | if (chars[3] != 'x') | ||
| 218 | /* Set-uid, but not executable by owner. */ | ||
| 219 | chars[3] = 'S'; | ||
| 220 | else | ||
| 221 | chars[3] = 's'; | ||
| 222 | } | ||
| 223 | #endif | ||
| 224 | #ifdef S_ISGID | ||
| 225 | if (bits & S_ISGID) | ||
| 226 | { | ||
| 227 | if (chars[6] != 'x') | ||
| 228 | /* Set-gid, but not executable by group. */ | ||
| 229 | chars[6] = 'S'; | ||
| 230 | else | ||
| 231 | chars[6] = 's'; | ||
| 232 | } | ||
| 233 | #endif | ||
| 234 | #ifdef S_ISVTX | ||
| 235 | if (bits & S_ISVTX) | ||
| 236 | { | ||
| 237 | if (chars[9] != 'x') | ||
| 238 | /* Sticky, but not executable by others. */ | ||
| 239 | chars[9] = 'T'; | ||
| 240 | else | ||
| 241 | chars[9] = 't'; | ||
| 242 | } | ||
| 243 | #endif | ||
| 244 | } | ||
| 245 | |||