Overview
| Artifact ID: | fef03fbc5949a6a1cf78f149b05c1f8f98845b9f |
|---|---|
| Ticket: | 1325803fffffffffffffffffffffffffffffffff
stat ino, nlink fields not set |
| User & Date: | obonilla on 2005-10-14 23:43:21 |
Changes
- icomment:
Logged In: YES user_id=219610 Make sure st_ino is at least defined as an unsigned. I don't know where you're getting your definition of struct stat from, but the one from MS's headers and the one in MSYS default st_ino to short, and both nFileIndexHigh and nFileIndexLow are DWORDs. You can imagine all the collisions you can get by casting a quad word to a short ;-) The other thing you guys might want to consider (although it might be too much work and you might just decide to punt on it) is that you can actually fake the st_nlink for directories and have it behave just like Unix. I wrote a little proc that goes something like: int dirEntries(const char *dir) { WIN32_FIND_DATA f; HANDLE h; char buf[MAXPATH]; int len, count = 0; strcpy(buf, dir); len = strlen(buf); if (len == 0 || buf[len - 1] == '\\' || buf[len - 1] == '/') { strcat(buf, "*"); } else { strcat(buf, "/*"); } if ((h = FindFirstFileA(buf, &f)) == INVALID_HANDLE_VALUE) return (0); count++; while (FindNextFileA(h &f)) { if (f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) count++; } FindClose(h); return (count); } You might want to tweak it to conform to Tcl-style and not use the *A API which is just for ASCII and doesn't handle Unicode. As I said, I don't know how useful this would be... it allows some optimizations when walking directory structures, but I don't know if anyone else uses those... - login: "obonilla"
- mimetype: "text/plain"
- username: "obonilla"