Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
10 num_files(const char *dir
)
16 if (!(fd
= opendir(dir
))) {
17 fprintf(stderr
, "opendir '%s': %s\n", dir
, strerror(errno
));
21 while ((dp
= readdir(fd
))) {
22 if (!strcmp(dp
->d_name
, ".") || !strcmp(dp
->d_name
, "..")) {
23 continue; /* skip self and parent */
30 return bprintf("%d", num
);