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

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

Re: fix for compiling grep 2.5.1 on beos [PATCH]


From: Paul Eggert
Subject: Re: fix for compiling grep 2.5.1 on beos [PATCH]
Date: 30 Jul 2003 12:05:50 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Stepan Kasal <address@hidden> writes:

-#ifndef DJGPP
-  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || 
S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode)))
-#else
-  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || 
S_ISBLK(stats->stat.st_mode)))
+  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || 
S_ISBLK(stats->stat.st_mode)
+#ifdef S_ISSOCK
+       || S_ISSOCK(stats->stat.st_mode)
 #endif
+      ))

How about using coreutils's technique instead?
It does something like this:

        #ifndef S_ISSOCK
        # ifdef S_IFSOCK
        #  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
        # else
        #  define S_ISSOCK(m) 0
        # endif
        #endif

in its src/sys2.h, and then the rest of the code can use S_ISSOCK
without all those ugly ifdefs.

For more on this subject, please see:

Henry Spencer and Goeff Collyer
#ifdef Considered Harmful, of Portability Experience with C News
Proc. Summer 1992 USENIX, pp 185-197
http://www.literateprogramming.com/ifdefs.pdf




reply via email to

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