minor refactor towards recursive dir_stat impl

This commit is contained in:
Doug MacEachern 2005-12-14 02:15:04 +00:00
parent f8060d5cf9
commit e058d29cc3

View File

@ -368,9 +368,10 @@ static __inline int file_type(char *file)
}
}
SIGAR_DECLARE(int) sigar_dir_stat_get(sigar_t *sigar,
const char *dir,
sigar_dir_stat_t *dirstats)
static int dir_stat_get(sigar_t *sigar,
const char *dir,
sigar_dir_stat_t *dirstats,
int recurse)
{
char name[SIGAR_PATH_MAX+1];
int len = strlen(dir);
@ -381,7 +382,6 @@ SIGAR_DECLARE(int) sigar_dir_stat_get(sigar_t *sigar,
DWORD error;
char delim;
SIGAR_ZERO(dirstats);
if (file_type((char *)dir) != SIGAR_FILETYPE_DIR) {
return ERROR_NO_MORE_FILES;
}
@ -468,6 +468,14 @@ SIGAR_DECLARE(int) sigar_dir_stat_get(sigar_t *sigar,
return SIGAR_OK;
}
SIGAR_DECLARE(int) sigar_dir_stat_get(sigar_t *sigar,
const char *dir,
sigar_dir_stat_t *dirstats)
{
SIGAR_ZERO(dirstats);
return dir_stat_get(sigar, dir, dirstats, 0);
}
#else
#include <dirent.h>