GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 }
char * G_mapset(void)
current mapset name
Definition: mapset.c:31
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
FILE * I_fopen_sigset_file_old(const char *group, const char *subgroup, const char *name)
Open existing signiture file in given group/subgroup.
Definition: sigsetfile.c:76
FILE * fd
Definition: g3dcolor.c:368
string name
Definition: render.py:1314
FILE * G_fopen_old_misc(const char *dir, const char *element, const char *name, const char *mapset)
open a database file for reading
Definition: open_misc.c:200
int G__make_mapset_element_misc(const char *dir, const char *name)
Create misc element in the current mapset.
Definition: mapset_msc.c:82
return NULL
Definition: dbfopen.c:1394
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
FILE * I_fopen_sigset_file_new(const char *group, const char *subgroup, const char *name)
Create new signiture file in given group/subgroup.
Definition: sigsetfile.c:32
FILE * G_fopen_new_misc(const char *dir, const char *element, const char *name)
open a new database file
Definition: open_misc.c:172
int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)
Definition: nme_in_mps.c:57