You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
499 B
26 lines
499 B
4 months ago
|
#define _XOPEN_SOURCE 500
|
||
|
#include <ftw.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
static int
|
||
|
display_info(const char *fpath, const struct stat *sb,
|
||
|
int tflag, struct FTW *ftwbuf)
|
||
|
{
|
||
|
printf("%s\n", fpath);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int
|
||
|
main(int argc, char *argv[])
|
||
|
{
|
||
|
int flags = FTW_PHYS;
|
||
|
if (nftw((argc < 2) ? "." : argv[1], display_info, 20, flags) == -1) {
|
||
|
perror("nftw");
|
||
|
exit(EXIT_FAILURE);
|
||
|
}
|
||
|
exit(EXIT_SUCCESS);
|
||
|
}
|