14 struct option options
[] =
16 { "depth", no_argument
, &do_depth
, 1 },
17 { "chdir", no_argument
, &do_chdir
, 1 },
18 { "phys", no_argument
, &do_phys
, 1 },
22 const char *flag2name
[] =
26 [FTW_DNR
] = "FTW_DNR",
35 cb (const char *name
, const struct stat
*st
, int flag
, struct FTW
*f
)
37 printf ("base = \"%.*s\", file = \"%s\", flag = %s",
38 f
->base
, name
, name
+ f
->base
, flag2name
[flag
]);
41 char *cwd
= getcwd (NULL
, 0);
42 printf (", cwd = %s", cwd
);
50 main (int argc
, char *argv
[])
57 while ((opt
= getopt_long_only (argc
, argv
, "", options
, NULL
)) != -1)
67 r
= nftw (optind
< argc
? argv
[optind
] : ".", cb
, 3, flag
);