Bernhard R. Link wrote:
> I like this. Added. Though a bit differently implemented.
> - no need to make things more complex and portable, when inotify is yet
>  quite linux only, thus just using d_type in dirent instead of stat
>  calls.

Hm, I did this to aid compatibility with etch, actually.  ISTM that
etch's glibc, unlike the glibc in sid, puts DT_UNKNOWN rather than
DT_REG in d_type.

E.g., the following very simple test...


#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>

int main(int argc, char **argv) {
    DIR *dir = opendir(argv[1]);
    struct dirent *ent;
    while( (ent = readdir(dir)) != NULL) {
        if( ent->d_type == DT_REG )
            printf("%s is DT_REG\n", ent->d_name);
        if( ent->d_type == DT_UNKNOWN )
            printf("%s is DT_UNKNOWN\n", ent->d_name);
    }
    return 0;
}

-- 
Robert Edmonds
[EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

Reply via email to