19 #include <sys/types.h> 24 static int G__remove(
int misc,
const char *dir,
const char *
element,
46 return G__remove(0,
NULL, element, name);
67 return G__remove(1, dir, element, name);
70 static int G__remove(
int misc,
const char *dir,
const char *
element,
80 if (strcmp(mapset, xmapset) != 0)
94 if (access(path, 0) != 0)
122 if (!S_ISDIR(sb.st_mode))
123 return remove(path) == 0 ? 0 : -1;
128 if (dp->d_name[0] ==
'.')
130 if (strlen(path) + strlen(dp->d_name) + 2 >
sizeof(path2))
132 sprintf(path2,
"%s/%s", path, dp->d_name);
137 return rmdir(path) == 0 ? 0 : -1;
char * G_file_name_misc(char *, const char *, const char *, const char *, const char *)
Builds full path names to GIS misc data files.
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
int G_legal_filename(const char *)
Check for legal database file name.
int G_recursive_remove(const char *path)
Recursively remove all files in given directory.
int G_remove(const char *element, const char *name)
Remove a database file.
const char * G_mapset(void)
Get current mapset name.
int G_remove_misc(const char *dir, const char *element, const char *name)
Remove a database misc file.
int G_name_is_fully_qualified(const char *, char *, char *)
Check if map name is fully qualified (map @ mapset)
int G_lstat(const char *, struct stat *)
Get file status.