41 G_fatal_error(
"Programming error: unknown signature file type");
62 static int list_by_type(
I_SIGFILE_TYPE,
const char *,
int,
char ***);
80 G_debug(1,
"I_signatures_remove(%d, %s);", type,
name);
115 const char *old_mapset,
const char *new_name)
123 G_debug(1,
"I_signatures_copy(%d, %s@%s, %s);", type, old_name, old_mapset,
128 if (strcmp(tmapset,
G_mapset()) != 0) {
129 G_warning(
_(
"%s is not in the current mapset (%s)"), new_name,
135 strcat(tname, new_name);
153 G_warning(
_(
"Unable to copy <%s> to current mapset as <%s>"),
173 const char *new_name)
180 G_debug(1,
"I_signatures_rename(%d, %s, %s);", type, old_name, new_name);
184 if (strcmp(tmapset,
G_mapset()) != 0) {
185 G_warning(
_(
"%s is not in the current mapset (%s)"), old_name,
191 strcat(sname, old_name);
193 if (strcmp(tmapset,
G_mapset()) != 0) {
194 G_warning(
_(
"%s is not in the current mapset (%s)"), new_name,
200 strcat(tname, new_name);
215 G_warning(
_(
"Unable to rename <%s> to <%s>"), old_name, new_name);
243 if (mapset ==
NULL) {
245 base += list_by_type(type, mapset, base, out_list);
249 base += list_by_type(type, mapset, base, out_list);
266 for (
int n = 0; n <
count; n++) {
273 static int list_by_type(
I_SIGFILE_TYPE type,
const char *mapset,
int base,
284 if (access(
path, 0) != 0) {
293 int mapset_len = strlen(mapset);
295 *out_list = (
char **)
G_realloc(*out_list, (base +
count) *
sizeof(
char *));
296 for (
int i = 0; i <
count; i++) {
297 (*out_list)[base + i] = (
char *)
G_malloc(
298 (strlen(dirlist[i]) + 1 + mapset_len + 1) *
sizeof(
char));
299 sprintf((*out_list)[base + i],
"%s@%s", dirlist[i], mapset);
int G_name_is_fully_qualified(const char *, char *, char *)
Check if map name is fully qualified (map @ mapset)
int G_recursive_copy(const char *, const char *)
Copy recursively source directory to destination directory.
void G_free(void *)
Free allocated memory.
int G_unqualified_name(const char *, const char *, char *, char *)
Returns unqualified map name (without @ mapset)
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
const char * G_get_mapset_name(int)
Get name of the n'th mapset from the current mapset search path.
int G_rename_file(const char *, const char *)
Rename a file or a directory in the filesystem.
int G_make_mapset_object_group(const char *)
Create directory for group of elements of a given type.
void void G_verbose_message(const char *,...) __attribute__((format(printf
const char * G_mapset(void)
Get current mapset name.
int G_remove(const char *, const char *)
Remove a database file.
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_debug(int, const char *,...) __attribute__((format(printf
const char * I_find_signature2(I_SIGFILE_TYPE, const char *, const char *)
Find mapset containing signature (look but don't touch)
int I_signatures_rename(I_SIGFILE_TYPE type, const char *old_name, const char *new_name)
Rename a signature file.
void I_free_signatures_list(int count, char ***list)
Free memory allocated by I_signatures_list_by_type.
void I_get_signatures_dir(char *dir, I_SIGFILE_TYPE type)
Get signature directory.
int I_signatures_remove(I_SIGFILE_TYPE type, const char *name)
Remove 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 I_signatures_copy(I_SIGFILE_TYPE type, const char *old_name, const char *old_mapset, const char *new_name)
Copy a signature file.
void I_make_signatures_dir(I_SIGFILE_TYPE type)
Make signature dir.