32 static int get_ref(
const char *, 
const char *, 
const char *, 
struct Ref *);
 
   33 static int set_color(
const char *, 
const char *, 
const char *, 
struct Ref *);
 
   34 static int put_ref(
const char *, 
const char *, 
const struct Ref *);
 
   48     stat = (fscanf(fd, 
"%255s", group) == 1);
 
   61     fprintf(fd, 
"%s\n", group);
 
   80     stat = (fscanf(fd, 
"%255s", subgroup) == 1);
 
   95     fprintf(fd, 
"%s\n", subgroup);
 
  113     return get_ref(group, 
"", 
NULL, ref);
 
  130     return get_ref(group, 
"", mapset, ref);
 
  148     return get_ref(group, subgroup, 
NULL, ref);
 
  166                         const char *mapset, 
struct Ref *ref)
 
  168     return get_ref(group, subgroup, mapset, ref);
 
  171 static int get_ref(
const char *group, 
const char *subgroup, 
const char *gmapset,
 
  186     if (gmapset == 
NULL || *gmapset == 0)
 
  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);
 
  214 static int set_color(
const char *
name, 
const char *mapset, 
const char *color,
 
  219     for (n = 0; n < ref->
nfiles; n++) {
 
  252     ref->red.table = 
NULL;
 
  253     ref->grn.table = 
NULL;
 
  256     ref->red.index = 
NULL;
 
  257     ref->grn.index = 
NULL;
 
  260     if (ref->
nfiles <= 0 || ref->red.n >= 0 || ref->
blu.
n >= 0 ||
 
  308     return put_ref(group, 
"", ref);
 
  327                        const struct Ref *ref)
 
  329     return put_ref(group, subgroup, ref);
 
  332 static int put_ref(
const char *group, 
const char *subgroup,
 
  333                    const struct Ref *ref)
 
  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++) {
 
  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;
 
  462     ref->red.table = ref->grn.table = ref->
blu.
table = 
NULL;
 
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
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)
const char * G_mapset(void)
Get current mapset name.
FILE * G_fopen_new(const char *, const char *)
Open a new database file.
void int G_suppress_warnings(int)
Suppress printing a warning message to stderr.
FILE * I_fopen_subgroup_ref_old2(const char *, const char *, const char *)
FILE * I_fopen_group_file_new(const char *, const char *)
FILE * I_fopen_subgroup_ref_new(const char *, const char *)
FILE * I_fopen_group_file_old(const char *, const char *)
Open group file for reading.
FILE * I_fopen_group_ref_new(const char *)
int I_find_group(const char *)
does group exist?
FILE * I_fopen_group_ref_old2(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)
struct Ref_Color red grn blu