32static int get_ref(
const char *,
const char *,
const char *,
struct Ref *);
33static int set_color(
const char *,
const char *,
const char *,
struct Ref *);
34static int put_ref(
const char *,
const char *,
const struct Ref *);
113 return get_ref(group,
"",
NULL,
ref);
130 return get_ref(group,
"", mapset,
ref);
166 const char *mapset,
struct Ref *
ref)
171static int get_ref(
const char *group,
const char *
subgroup,
const char *
gmapset,
198 while (
G_getl2(buf,
sizeof buf, fd)) {
199 int n =
sscanf(buf,
"%255s %255s %15s",
name, mapset,
201 if (n == 2 || n == 3) {
204 set_color(
name, mapset, color,
ref);
214static int set_color(
const char *
name,
const char *mapset,
const char *color,
219 for (n = 0; n <
ref->nfiles; n++) {
221 strcmp(
ref->file[n].mapset, mapset) == 0)
260 if (
ref->nfiles <= 0 ||
ref->red.n >= 0 ||
ref->blu.n >= 0 ||
263 switch (
ref->nfiles) {
308 return put_ref(group,
"",
ref);
332static int put_ref(
const char *group,
const char *
subgroup,
345 for (n = 0; n <
ref->nfiles; n++) {
347 if (n ==
ref->red.n || n ==
ref->grn.n || n ==
ref->blu.n) {
385 for (n = 0; n <
ref->nfiles; n++) {
387 strcmp(
ref->file[n].mapset, mapset) == 0)
391 if ((n =
ref->nfiles++))
435 if (n ==
ref2->red.n)
437 if (n ==
ref2->grn.n)
439 if (n ==
ref2->blu.n)
461 ref->red.n =
ref->grn.n =
ref->blu.n = -1;
AMI_err name(char **stream_name)
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
int G_unqualified_name(const char *, const char *, char *, char *)
Returns unqualified map name (without @ mapset)
FILE * G_fopen_new(const char *, const char *)
Open a new database file.
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
void int G_suppress_warnings(int)
Suppress printing a warning message to stderr.
const char * G_mapset(void)
Get current mapset name.
FILE * I_fopen_group_file_old(const char *, const char *)
Open group file for reading.
FILE * I_fopen_group_ref_new(const char *)
FILE * I_fopen_group_ref_old2(const char *, const char *)
int I_find_group(const char *)
does group exist?
FILE * I_fopen_group_file_new(const char *, const char *)
FILE * I_fopen_subgroup_ref_new(const char *, const char *)
FILE * I_fopen_subgroup_ref_old2(const char *, const char *, const char *)
int I_get_subgroup(const char *group, char *subgroup)
int I_put_subgroup_ref(const char *group, const char *subgroup, const struct Ref *ref)
write subgroup REF file
int I_add_file_to_group_ref(const char *name, const char *mapset, struct Ref *ref)
add file name to Ref structure
int I_put_subgroup(const char *group, const char *subgroup)
int I_get_subgroup_ref2(const char *group, const char *subgroup, const char *mapset, struct Ref *ref)
read subgroup REF file
int I_get_group_ref(const char *group, struct Ref *ref)
read group REF file
int I_transfer_group_ref_file(const struct Ref *ref2, int n, struct Ref *ref1)
copy Ref lists
int I_init_ref_color_nums(struct Ref *ref)
int I_free_group_ref(struct Ref *ref)
free Ref structure
int I_get_subgroup_ref(const char *group, const char *subgroup, struct Ref *ref)
read subgroup REF file
int I_get_group_ref2(const char *group, const char *mapset, struct Ref *ref)
read group REF file
int I_put_group_ref(const char *group, const struct Ref *ref)
write group REF file
int I_init_group_ref(struct Ref *ref)
initialize Ref structure
int I_get_group(char *group)
int I_put_group(const char *group)