file utilities

git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@995 a7169a2c-3604-0410-bc95-c702d8d87f7a
This commit is contained in:
drotos 2007-01-04 10:26:23 +00:00 committed by Adam Visegradi
parent 31f0fee320
commit 8ad00421e4
2 changed files with 20 additions and 0 deletions

View File

@ -116,6 +116,24 @@ _DC_rm(char *name)
}
int
_DC_file_exists(char *fn)
{
return(access(fn, F_OK) == 0);
}
int
_DC_file_empty(char *fn)
{
struct stat s;
if (stat(fn, &s))
return(1);
return(s.st_size == 0);
}
int
_DC_create_file(char *fn, char *what)
{

View File

@ -23,6 +23,8 @@ extern void _DC_init_utils(void);
/* Usefull funcs */
extern int _DC_mkdir_with_parents(char *dn, mode_t mode);
extern int _DC_rm(char *name);
extern int _DC_file_exists(char *fn);
extern int _DC_file_empty(char *fn);
extern int _DC_create_file(char *fn, char *what);
extern char *_DC_get_file(char *fn);