Bit pattern of S_IFREG (was Re: What is wrong with this code ?)
Martin Weitzel
martin at mwtech.UUCP
Sun Dec 17 23:37:38 AEST 1989
In article <2722 at auspex.UUCP> guy at auspex.auspex.com (Guy Harris) writes:
[many lines deleted, because not relevant to my question]
>
> #define S_IFMT 0170000 /* type of file */
> #define S_IFDIR 0040000 /* directory */
> #define S_IFCHR 0020000 /* character special */
> #define S_IFBLK 0060000 /* block special */
> #define S_IFREG 0100000 /* regular */
I think I have seen on some older systems, that for regular files
you must test for both (st_mode & S_IFMT) == S_IFREG
and *additionally* (st_mode & S_IFMT) == 0.
I don't know if this is still true today.
--
<<< MW -- email: see header -- voice: 49-(0)6151-6 56 83 >>>
More information about the Comp.unix.questions
mailing list