lsflib/src/getdir.c
changeset 150 75133486ba7e
parent 136 d82f65e902d0
child 158 2cddd4d26139
equal deleted inserted replaced
149:5acf77b9b7a0 150:75133486ba7e
    15 
    15 
    16 int isDir (char *filename)
    16 int isDir (char *filename)
    17 {
    17 {
    18     struct stat buf;
    18     struct stat buf;
    19 
    19 
    20     if (!stat (filename, &buf))
    20     if (!lstat (filename, &buf))
    21         return (S_ISDIR (buf.st_mode));
    21         return (S_ISDIR (buf.st_mode));
    22 
    22 
    23     return 0;
    23     return 0;
    24 }
    24 }
    25 
    25 
    26 int isFile (char *filename)
    26 int isFile (char *filename)
    27 {
    27 {
    28     struct stat buf;
    28     struct stat buf;
    29 
    29 
    30     if (!stat (filename, &buf))
    30     if (!lstat (filename, &buf))
    31         return (S_ISREG (buf.st_mode));
    31         return (S_ISREG (buf.st_mode));
       
    32 
       
    33     return 0;
       
    34 }
       
    35 
       
    36 int isLink (char *filename)
       
    37 {
       
    38     struct stat buf;
       
    39 
       
    40     if (!lstat (filename, &buf))
       
    41         return (S_ISLNK (buf.st_mode));
    32 
    42 
    33     return 0;
    43     return 0;
    34 }
    44 }
    35 
    45 
    36 void getdir (char *root, int recursive)
    46 void getdir (char *root, int recursive)