GRASS Programmer's Manual  6.4.2(2012)
sigsetfile.c
Go to the documentation of this file.
00001 
00014 #include <string.h>
00015 
00016 #include <grass/gis.h>
00017 #include <grass/imagery.h>
00018 #include <grass/glocale.h>
00019 
00032 FILE *I_fopen_sigset_file_new(const char *group, const char *subgroup,
00033                               const char *name)
00034 {
00035     char element[GPATH_MAX];
00036     char group_name[GNAME_MAX], mapset[GMAPSET_MAX];
00037     FILE *fd;
00038 
00039     if (G__name_is_fully_qualified(group, group_name, mapset)) {
00040         if (strcmp(mapset, G_mapset()) != 0)
00041             G_warning(_("Unable to create signature file <%s> for subgroup <%s> "
00042                         "of group <%s> - <%s> is not current mapset"),
00043                       name, subgroup, group, mapset);
00044     }
00045     else { 
00046         strcpy(group_name, group);
00047     }
00048 
00049     /* create sigset directory */
00050     sprintf(element, "%s/subgroup/%s/sigset", group_name, subgroup);
00051     G__make_mapset_element_misc("group", element);
00052 
00053     sprintf(element, "subgroup/%s/sigset/%s", subgroup, name);
00054 
00055     fd = G_fopen_new_misc("group", element, group_name);
00056     if (fd == NULL)
00057         G_warning(_("Unable to create signature file <%s> for subgroup <%s> "
00058                     "of group <%s>"),
00059                   name, subgroup, group);
00060     
00061     return fd;
00062 }
00063 
00076 FILE *I_fopen_sigset_file_old(const char *group, const char *subgroup,
00077                               const char *name)
00078 {
00079     char element[GPATH_MAX];
00080     FILE *fd;
00081 
00082     sprintf(element, "subgroup/%s/sigset/%s", subgroup, name);
00083 
00084     fd = G_fopen_old_misc("group", element, group, G_mapset());
00085     if (fd == NULL)
00086         G_warning(_("Unable to open signature file <%s> for subgroup <%s> "
00087                     "of group <%s@%s>"),
00088                   name, subgroup, group, G_mapset());
00089     
00090     return fd;
00091 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines