home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!wupost!spool.mu.edu!agate!dog.ee.lbl.gov!horse.ee.lbl.gov!torek
- From: torek@horse.ee.lbl.gov (Chris Torek)
- Newsgroups: comp.lang.c
- Subject: Re: curses.h dirent.h
- Date: 14 Dec 1992 03:09:36 GMT
- Organization: Lawrence Berkeley Laboratory, Berkeley CA
- Lines: 20
- Distribution: usa
- Message-ID: <27966@dog.ee.lbl.gov>
- References: <ByzE2M.3vH@ns1.nodak.edu> <Ef9Yx2i00WB=A3GkIJ@andrew.cmu.edu>
- NNTP-Posting-Host: 128.3.112.15
-
- (Note that dirent.h is a POSIX thing, not a C thing. Similarly,
- discussion about stat() belongs elsewhere. This correction goes to
- comp.lang.c only because the article quoted below was posted there.)
-
- In article <Ef9Yx2i00WB=A3GkIJ@andrew.cmu.edu> Tod McQuillin
- <tm8t+@andrew.cmu.edu> writes:
- > if (statbuf.st_mode & S_IFDIR) /* Is it a directory? */
-
- The `file type' in a stat `st_mode' field is not a set of individual
- bits, but rather a number. This is something like testing the bit
- (1<<2) to see if a value equals four: it will give false positives.
- The Official POSIX Method is to use S_ISDIR(statbuf.st_mode). The
- Classic Unix method is ((statbuf.st_mode & S_IFMT) == S_IFDIR); the
- test quoted above happens to give false positives for block devices
- and sockets on traditional Unix boxes.
-
- We now return you to appropriate comp.lang.c material (I hope) :-) .
- --
- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
- Berkeley, CA Domain: torek@ee.lbl.gov
-