Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: comp.unix.questions Subject: Bit pattern of S_IFREG (was Re: What is wrong with this code ?) Message-ID: <553@mwtech.UUCP> Date: 17 Dec 89 12:37:38 GMT References: <1156@nsscb.UUCP> <1323@mitisft.Convergent.COM> <2722@auspex.UUCP> Reply-To: martin@mwtech.UUCP (Martin Weitzel) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 16 In article <2722@auspex.UUCP> guy@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 >>>