diff -r 000000000000 -r 6f7a81934006 lib/misc/stat_fns.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/misc/stat_fns.h Wed Jan 16 22:39:43 2008 +0100 @@ -0,0 +1,31 @@ +#ifndef VMAILMGR__STAT_FNS__H__ +#define VMAILMGR__STAT_FNS__H__ + +#include +#include + +inline bool is_exist(const char* filename) +{ + struct stat buf; + return !stat(filename, &buf); +} + +inline bool is_dir(const char* filename) +{ + struct stat buf; + return !stat(filename, &buf) && S_ISDIR(buf.st_mode); +} + +inline bool is_symlink(const char* filename) +{ + struct stat buf; + return !lstat(filename, &buf) && S_ISLNK(buf.st_mode); +} + +inline bool is_file(const char* filename) +{ + struct stat buf; + return !stat(filename, &buf) && S_ISREG(buf.st_mode); +} + +#endif