GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
sigsetfile.c
Go to the documentation of this file.
1 
14 #include <string.h>
15 
16 #include <grass/gis.h>
17 #include <grass/imagery.h>
18 #include <grass/glocale.h>
19 
32 FILE *I_fopen_sigset_file_new(const char *group, const char *subgroup,
33  const char *name)
34 {
35  char element[GPATH_MAX];
36  char group_name[GNAME_MAX], mapset[GMAPSET_MAX];
37  FILE *fd;
38 
39  if (G__name_is_fully_qualified(group, group_name, mapset)) {
40  if (strcmp(mapset, G_mapset()) != 0)
41  G_warning(_("Unable to create signature file <%s> for subgroup <%s> "
42  "of group <%s> - <%s> is not current mapset"),
43  name, subgroup, group, mapset);
44  }
45  else {
46  strcpy(group_name, group);
47  }
48 
49  /* create sigset directory */
50  sprintf(element, "%s/subgroup/%s/sigset", group_name, subgroup);
51  G__make_mapset_element_misc("group", element);
52 
53  sprintf(element, "subgroup/%s/sigset/%s", subgroup, name);
54 
55  fd = G_fopen_new_misc("group", element, group_name);
56  if (fd == NULL)
57  G_warning(_("Unable to create signature file <%s> for subgroup <%s> "
58  "of group <%s>"),
59  name, subgroup, group);
60 
61  return fd;
62 }
63 
76 FILE *I_fopen_sigset_file_old(const char *group, const char *subgroup,
77  const char *name)
78 {
79  char element[GPATH_MAX];
80  FILE *fd;
81 
82  sprintf(element, "subgroup/%s/sigset/%s", subgroup, name);
83 
84  fd = G_fopen_old_misc("group", element, group, G_mapset());
85  if (fd == NULL)
86  G_warning(_("Unable to open signature file <%s> for subgroup <%s> "
87  "of group <%s@%s>"),
88  name, subgroup, group, G_mapset());
89 
90  return fd;
91 }