fts.c
changeset 68 d549894aa6a9
parent 67 abe63a276a36
child 77 49e0babccb23
equal deleted inserted replaced
67:abe63a276a36 68:d549894aa6a9
     7 
     7 
     8 #include <sys/types.h>
     8 #include <sys/types.h>
     9 #include <sys/stat.h>
     9 #include <sys/stat.h>
    10 
    10 
    11 #include <fts.h>
    11 #include <fts.h>
       
    12 #include <errno.h>
    12 
    13 
    13 int compare (const FTSENT ** a, const FTSENT ** b)
    14 int compare (const FTSENT ** a, const FTSENT ** b)
    14 {
    15 {
    15     return 0;
    16     return 0;
    16 }
    17 }
    44         perror ("fts_open");
    45         perror ("fts_open");
    45         return EXIT_FAILURE;
    46         return EXIT_FAILURE;
    46     }
    47     }
    47 
    48 
    48     while ((current = fts_read (fts)) != NULL) {
    49     while ((current = fts_read (fts)) != NULL) {
    49         printf ("%s/%s\n", current->fts_path, current->fts_name);
    50         if (!errno)
       
    51             printf ("%s/%s\n", current->fts_path, current->fts_name);
    50     }
    52     }
    51 
    53 
    52     if (fts_close (fts) < 0)
    54     if (fts_close (fts) < 0)
    53         perror ("fts_close");
    55         perror ("fts_close");
    54 
    56