62 #include <sys/types.h> 83 static int count_file2(
const char *
filename,
const struct stat *sb,
int tflag,
struct FTW *ftwbuf)
109 static int for_each_file2(
const Octstr *dir_s,
int ignore_err,
110 int(*cb)(
const char *,
const struct stat *,
int,
struct FTW *))
121 int(*cb)(
const char *,
const struct stat *,
int,
void *))
126 #ifndef _DIRENT_HAVE_D_TYPE 134 while ((ent = readdir(dir)) != NULL) {
136 if (!(strcmp((
char*)ent->d_name,
"." ) != 0 && strcmp((
char*)ent->d_name,
".." ) != 0))
139 #ifdef _DIRENT_HAVE_D_TYPE 142 }
else if (ent->d_type == DT_REG && cb != NULL) {
152 }
else if (S_ISREG(stat.st_mode) && cb != NULL) {
157 if (ret == -1 && ignore_err)
168 int main(
int argc,
char **argv)
182 diff = (time(NULL) -
start);
188 for_each_file2(os2, 1, count_file2);
189 diff = (time(NULL) -
start);
void error(int err, const char *fmt,...)
static int for_each_file(const Octstr *dir_s, int ignore_err, int(*cb)(const char *, const struct stat *, int, void *))
void counter_destroy(Counter *counter)
unsigned long counter_set(Counter *counter, unsigned long n)
#define octstr_get_cstr(ostr)
unsigned long counter_increase(Counter *counter)
Counter * counter_create(void)
int main(int argc, char **argv)
static int count_file(const char *filename, const struct stat *sb, int tflag, void *ftwbuf)
Octstr * octstr_format(const char *fmt,...)
void octstr_destroy(Octstr *ostr)
char filename[FILENAME_MAX+1]
#define octstr_create(cstr)
unsigned long counter_value(Counter *counter)
void debug(const char *place, int err, const char *fmt,...)
void gwlib_shutdown(void)