[go: up one dir, main page]

File: test-ftw.c

package info (click to toggle)
fakechroot 2.19-3.3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,148 kB
  • sloc: ansic: 6,893; sh: 5,995; makefile: 349; perl: 169; java: 5
file content (25 lines) | stat: -rw-r--r-- 443 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <ftw.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>


static int callback(const char *fpath, const struct stat *sb, int typeflag) {
    printf("%s\n", fpath);
    return 0;
}


int main (int argc, char *argv[]) {
    if (argc != 2) {
        fprintf(stderr, "Usage: %s path\n", argv[0]);
        exit(2);
    }

    if (ftw(argv[1], callback, 16) == -1) {
        perror("ftw");
        exit(1);
    }

    return 0;
}