38 G_fatal_error(
"Programming error: unknown signature file type");
59 static int list_by_type(
I_SIGFILE_TYPE,
const char *,
int,
char ***);
77 G_debug(1,
"I_signatures_remove(%d, %s);", type, name);
82 G_warning(
_(
"%s is not in the current mapset (%s)"), name,
92 G_warning(
_(
"Unable to remove %s signature"), name);
113 const char *old_mapset,
const char *new_name)
121 G_debug(1,
"I_signatures_copy(%d, %s@%s, %s);", type, old_name,
122 old_mapset, new_name);
126 if (strcmp(tmapset,
G_mapset()) != 0) {
127 G_warning(
_(
"%s is not in the current mapset (%s)"), new_name,
133 strcat(tname, new_name);
151 G_warning(
_(
"Unable to copy <%s> to current mapset as <%s>"),
171 const char *new_name)
178 G_debug(1,
"I_signatures_rename(%d, %s, %s);", type, old_name, new_name);
182 if (strcmp(tmapset,
G_mapset()) != 0) {
183 G_warning(
_(
"%s is not in the current mapset (%s)"), old_name,
189 strcat(sname, old_name);
191 if (strcmp(tmapset,
G_mapset()) != 0) {
192 G_warning(
_(
"%s is not in the current mapset (%s)"), new_name,
198 strcat(tname, new_name);
213 G_warning(
_(
"Unable to rename <%s> to <%s>"), old_name, new_name);
241 if (mapset ==
NULL) {
243 base += list_by_type(type, mapset, base, out_list);
247 base += list_by_type(type, mapset, base, out_list);
264 for (
int n = 0; n <
count; n++) {
271 static int list_by_type(
I_SIGFILE_TYPE type,
const char *mapset,
int base,
282 if (access(path, 0) != 0) {
286 dirlist =
G_ls2(path, &count);
291 int mapset_len = strlen(mapset);
294 (
char **)
G_realloc(*out_list, (base + count) *
sizeof(
char *));
295 for (
int i = 0; i <
count; i++) {
296 (*out_list)[base + i] =
297 (
char *)
G_malloc((strlen(dirlist[i]) + 1 + mapset_len + 1) *
299 sprintf((*out_list)[base + i],
"%s@%s", dirlist[i], mapset);
const char * I_find_signature2(I_SIGFILE_TYPE, const char *, const char *)
Find mapset containing signature (look but don't touch)
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int G_remove(const char *, const char *)
Remove a database file.
void I_make_signatures_dir(I_SIGFILE_TYPE type)
Make signature dir.
int I_signatures_rename(I_SIGFILE_TYPE type, const char *old_name, const char *new_name)
Rename a signature file.
int G_rename_file(const char *, const char *)
Rename a file or a directory in the filesystem.
int G_unqualified_name(const char *, const char *, char *, char *)
Returns unqualified map name (without @ mapset)
void I_free_signatures_list(int count, char ***list)
Free memory allocated by I_signatures_list_by_type.
void G_free(void *)
Free allocated memory.
char ** G_ls2(const char *, int *)
Stores a sorted directory listing in an array.
char * G_fully_qualified_name(const char *, const char *)
Get fully qualified element name.
int G_recursive_copy(const char *, const char *)
Copy recursively source directory to destination directory.
void I_get_signatures_dir(char *dir, I_SIGFILE_TYPE type)
Get signature directory.
const char * G_mapset(void)
Get current mapset name.
void G_warning(const char *,...) __attribute__((format(printf
int I_signatures_copy(I_SIGFILE_TYPE type, const char *old_name, const char *old_mapset, const char *new_name)
Copy a signature file.
int I_signatures_list_by_type(I_SIGFILE_TYPE type, const char *mapset, char ***out_list)
Get list of existing signatures by type.
int G_name_is_fully_qualified(const char *, char *, char *)
Check if map name is fully qualified (map @ mapset)
void void G_verbose_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int G_make_mapset_object_group(const char *)
Create directory for group of elements of a given type.
const char * G_get_mapset_name(int)
Get name of the n'th mapset from the current mapset search path.
int I_signatures_remove(I_SIGFILE_TYPE type, const char *name)
Remove a signature file.