GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sigfile.c
Go to the documentation of this file.
1 
14 #include <string.h>
15 #include <grass/imagery.h>
16 
27 FILE *I_fopen_signature_file_new(const char *group,
28  const char *subgroup, const char *name)
29 {
30  char element[GPATH_MAX];
31  char group_name[GNAME_MAX], group_mapset[GMAPSET_MAX];
32  FILE *fd;
33 
34  if (!G__name_is_fully_qualified(group, group_name, group_mapset)) {
35  strcpy(group_name, group);
36  }
37 
38  /* create sigset directory */
39  sprintf(element, "%s/subgroup/%s/sig", group_name, subgroup);
40  G__make_mapset_element_misc("group", element);
41 
42  sprintf(element, "subgroup/%s/sig/%s", subgroup, name);
43 
44  fd = G_fopen_new_misc("group", element, group_name);
45 
46  return fd;
47 }
48 
59 FILE *I_fopen_signature_file_old(const char *group,
60  const char *subgroup, const char *name)
61 {
62  char element[GPATH_MAX];
63  char group_name[GNAME_MAX], group_mapset[GMAPSET_MAX];
64  FILE *fd;
65 
66  if (!G__name_is_fully_qualified(group, group_name, group_mapset)) {
67  strcpy(group_name, group);
68  }
69 
70  sprintf(element, "subgroup/%s/sig/%s", subgroup, name);
71 
72  fd = G_fopen_old_misc("group", element, group_name, G_mapset());
73 
74  return fd;
75 }
char * G_mapset(void)
current mapset name
Definition: mapset.c:31
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
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
FILE * I_fopen_signature_file_old(const char *group, const char *subgroup, const char *name)
Open signature file.
Definition: sigfile.c:59
int G__make_mapset_element_misc(const char *dir, const char *name)
Create misc element in the current mapset.
Definition: mapset_msc.c:82
FILE * I_fopen_signature_file_new(const char *group, const char *subgroup, const char *name)
Create signature file.
Definition: sigfile.c:27
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