Date: Sun, 30 Oct 1994 11:38:29 +0100 From: terra AT diku DOT dk To: eliz AT is DOT elta DOT co DOT il Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: stat()/fstat() for DJGPP, v.02 Date: Sun, 30 Oct 94 08:53:56 +0200 From: "Eli Zaretskii" X-Mts: smtp I've uploaded to omnigate a corrected version of stat() and fstat() library functions for DJGPP. A few comments based on your description alone: 3. Both functions set mode bits for all three groups (user, group, other). Only user gets WRITE access to a file (unless it has Read-only, Hidden or System bit set). 4. stat() sets EXECUTE bit for directories, as it happens under Unix, and sets their WRITE access bit for the ``user'' group unless they have one of Read-only, System or Hidden bit set. Why the Hidden/System bit part? 5. Directory size is not reported zero by stat(); the number of used directory entries (sans the ``.'' and ``..'' pseudo-entries) multiplied by entry size is returned instead for those directories which are reported zero size by DOS (some network redirectors do bring valid size for a directory). This could be expensive and is misleading. If you create a directory with 1000 files then delete them all, the size of the directory should not change. 6. fstat() correctly reports access mode bits and device code (st_dev). 7. Both functions report EXECUTE bits based on file's extension and the two-byte magic number present at the beginning of the file. Again this is expensive. 3. I don't know how to obtain time fields for root directories, so they are set to the beginning of the DOS times (1-Jan-80). Suggestions, anyone? You could use the volume label as a better fall back. Also, I think there are some time stamp in the boot record. Semi-expensive to get at, though. Morten Welinder terra AT diku DOT dk -- ------------------------------------------------------------------------- For information on the free Republic of Macedonia connect to the WWW link http://ASUdesign.eas.asu.edu/places/Macedonia/republic/ -------------------------------------------Morten Welinder, terra AT diku DOT dk