bug-findutils
[Top][All Lists]
Advanced

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

[PATCH] Don't define S_IS*; include <sys/stat.h> instead.


From: James Youngman
Subject: [PATCH] Don't define S_IS*; include <sys/stat.h> instead.
Date: Fri, 2 Apr 2010 01:48:23 +0100

* lib/modetype.h: Remove (all it does is define S_IS*).
* lib/Makefile.am (EXTRA_DIST): Remove modetype.h.
* lib/listfile.c: Don't define S_IS* macros.
* find/pred.c: Don't include "modetype.h".
* find/parser.c: Likewise.
* find/ftsfind.c: Likewise.
* find/fstype.c: Likewise.
* find/find.c: Likewise.

Signed-off-by: James Youngman <address@hidden>
---
 ChangeLog       |   10 ++++
 find/find.c     |    1 -
 find/fstype.c   |    1 -
 find/ftsfind.c  |    1 -
 find/parser.c   |    2 +-
 find/pred.c     |    1 -
 lib/Makefile.am |    2 +-
 lib/listfile.c  |   16 ------
 lib/modetype.h  |  142 -------------------------------------------------------
 9 files changed, 12 insertions(+), 164 deletions(-)
 delete mode 100644 lib/modetype.h

diff --git a/ChangeLog b/ChangeLog
index 4cf978c..82545c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,16 @@
 
 2010-04-02  James Youngman  <address@hidden>
 
+       Don't define S_IS*; include <sys/stat.h> instead.
+       * lib/modetype.h: Remove (all it does is define S_IS*).
+       * lib/Makefile.am (EXTRA_DIST): Remove modetype.h.
+       * lib/listfile.c: Don't define S_IS* macros.
+       * find/pred.c: Don't include "modetype.h".
+       * find/parser.c: Likewise.
+       * find/ftsfind.c: Likewise.
+       * find/fstype.c: Likewise.
+       * find/find.c: Likewise.
+
        * m4/withfts.m4: Quote the first argument of AC_DEFINE.
 
        Coding standard fix: "Warning" should be "WARNING".
diff --git a/find/find.c b/find/find.c
index 2cacc6f..a9e9ef0 100644
--- a/find/find.c
+++ b/find/find.c
@@ -41,7 +41,6 @@
 #include "xalloc.h"
 #include "human.h"
 #include "canonicalize.h"
-#include <modetype.h>
 
 #include "closein.h"
 #include "savedirinfo.h"
diff --git a/find/fstype.c b/find/fstype.c
index 88d4208..0de4ad0 100644
--- a/find/fstype.c
+++ b/find/fstype.c
@@ -54,7 +54,6 @@ extern int errno;
 #include "defs.h"
 #include "../gnulib/lib/dirname.h"
 #include "xalloc.h"
-#include "modetype.h"
 
 /* Need declaration of function `xstrtoumax' */
 #include "../gnulib/lib/xstrtol.h"
diff --git a/find/ftsfind.c b/find/ftsfind.c
index 71bbee4..3e9315a 100644
--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -46,7 +46,6 @@
 
 #include "xalloc.h"
 #include "closeout.h"
-#include <modetype.h>
 #include "quotearg.h"
 #include "quote.h"
 #include "fts_.h"
diff --git a/find/parser.c b/find/parser.c
index 6083298..054460e 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -26,9 +26,9 @@
 #include <errno.h>
 #include <grp.h>
 #include <fnmatch.h>
+#include <sys/stat.h>
 #include "mountlist.h"
 #include "modechange.h"
-#include "modetype.h"
 #include "xstrtol.h"
 #include "xalloc.h"
 #include "quote.h"
diff --git a/find/pred.c b/find/pred.c
index cb14861..5886437 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -37,7 +37,6 @@
 #include "xalloc.h"
 #include "dirname.h"
 #include "human.h"
-#include "modetype.h"
 #include "filemode.h"
 #include "printquoted.h"
 #include "buildcmd.h"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 57fc0a1..4a3d7f7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -19,7 +19,7 @@ TESTS += check-regexprops
 endif
 
 libfind_a_SOURCES = gnulib-version.c findutils-version.c
-EXTRA_DIST = modetype.h extendbuf.h savedirinfo.h buildcmd.h \
+EXTRA_DIST = extendbuf.h savedirinfo.h buildcmd.h \
        gnulib-version.h gnulib-version.c findutils-version.h \
        fdleak.h check-regexprops.sh
 BUILT_SOURCES = gnulib-version.c
diff --git a/lib/listfile.c b/lib/listfile.c
index 392245a..c3a93e3 100644
--- a/lib/listfile.c
+++ b/lib/listfile.c
@@ -74,22 +74,6 @@
 
 
 
-#ifdef STAT_MACROS_BROKEN
-#undef S_ISCHR
-#undef S_ISBLK
-#undef S_ISLNK
-#endif
-
-#ifndef S_ISCHR
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#ifndef S_ISBLK
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if defined S_IFLNK && !defined S_ISLNK
-#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-
 /* Get or fake the disk device blocksize.
    Usually defined by sys/param.h (if at all).  */
 #ifndef DEV_BSIZE
diff --git a/lib/modetype.h b/lib/modetype.h
deleted file mode 100644
index 9d8ee40..0000000
--- a/lib/modetype.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* modetype.h -- file type bits definitions for POSIX systems
-   Requires sys/types.h sys/stat.h.
-   Copyright (C) 1990, 2007 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/* POSIX.1 doesn't mention the S_IFMT bits; instead, it uses S_IStype
-   test macros.  To make storing file types more convenient, define
-   them; the values don't need to correspond to what the kernel uses,
-   because of the way we use them. */
-#ifndef INC_MODETYPE_H
-#define INC_MODETYPE_H 1
-
-#ifndef S_IFMT                 /* Doesn't have traditional Unix macros. */
-#define S_IFBLK 1
-#define S_IFCHR 2
-#define S_IFDIR 4
-#define S_IFREG 8
-#ifdef S_ISLNK
-#define S_IFLNK 16
-#endif
-#ifdef S_ISFIFO
-#define S_IFIFO 32
-#endif
-#ifdef S_ISSOCK
-#define S_IFSOCK 64
-#endif
-#ifdef S_ISDOOR
-#define S_IFDOOR 128
-#endif
-#endif /* !S_IFMT */
-
-#ifdef STAT_MACROS_BROKEN
-#undef S_ISBLK
-#undef S_ISCHR
-#undef S_ISDIR
-#undef S_ISREG
-#undef S_ISFIFO
-#undef S_ISLNK
-#undef S_ISSOCK
-#undef S_ISDOOR
-#undef S_ISMPB
-#undef S_ISMPC
-#undef S_ISNWK
-#endif
-
-/* Do the reverse: define the POSIX.1 macros for traditional Unix systems
-   that don't have them.  */
-#if !defined(S_ISBLK) && defined(S_IFBLK)
-#define        S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if !defined(S_ISCHR) && defined(S_IFCHR)
-#define        S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define        S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISREG) && defined(S_IFREG)
-#define        S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#if !defined(S_ISFIFO) && defined(S_IFIFO)
-#define        S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-#define        S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#if !defined(S_ISSOCK) && defined(S_IFSOCK)
-#define        S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#endif
-#if !defined(S_ISDOOR) && defined(S_IFDOOR)
-#define        S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
-#endif
-#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
-/* Also available on Coherent, according to
- * Albert D. Cahalan (address@hidden)
- */
-#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) /* multiplexed block device */
-#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) /* multiplexed char  device */
-/* GNU BFD library source uses type letter 'm' for these */
-#endif
-
-#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
-/* Apparently HPUX ls gives 'n' as the type letter for these. */
-#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#endif
-
-#endif
-
-/* The above macros don't handle
- * /bin/ls letters     Mode    What is it?
- *                     S_IFNAM (Xenix "name files")
- *  H                  S_ISCDF (HPUX Context Dependent Files)
- *                     S_IFCMP
- *                     S_IFSHAD
- */
-
-/*
-In message <address@hidden>
-Albert Cahalan wrote:-
-
-BTW, I believe many of these can't actually exist on disk.
-Some of these (like S_IFSHAD AFAIK) are not seen by userspace.
-
-hex  name     ls octal  description
-0000             000000 SCO out-of-service inode, BSD unknown type
-1000 S_IFIFO  p| 010000 fifo (named pipe)
-2000 S_IFCHR  c  020000 character special
-3000 S_IFMPC     030000 multiplexed character device (Coherent)
-4000 S_IFDIR  d/ 040000 directory
-5000 S_IFNAM     050000 XENIX special named file
-6000 S_IFBLK  b  060000 block special
-7000 S_IFMPB     070000 multiplexed block device (Coherent)
-8000 S_IFREG  -  100000 regular
-9000 S_IFCMP     110000 VxFS compressed (file?)
-9000 S_IFNWK     110000 HP-UX network special
-a000 S_IFLNK  l@ 120000 symbolic link
-b000 S_IFSHAD    130000 Solaris shadow inode for ACL
-c000 S_IFSOCK s= 140000 socket (also "S_IFSOC" on VxFS)
-d000 S_IFDOOR D  150000 Solaris door
-e000 S_IFWHT  w% 160000 BSD whiteout (not used for inode)
-f000 S_IFMT      170000 mask (not used for inode)
-hex  name     ls octal  description
-0200 S_ISVTX     001000 save swapped text even after use
-0400 S_ISGID     002000 set group ID on execution
-0400 S_ENFMT     002000 SysV forced file locking (shared w/ S_ISGID)
-0800 S_CDF       004000 HP-UX hidden directory
-0800 S_ISUID     004000 set user ID on execution
-
-
-*/
-- 
1.5.6.5





reply via email to

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