GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
imagery/find.c
Go to the documentation of this file.
1 
2 /**************************************************************
3 * I_find_group (group)
4 *
5 * Find the a group in the current mapset
6 **************************************************************/
7 #include <grass/imagery.h>
8 #include <grass/gis.h>
9 
10 
21 int I_find_group(const char *group)
22 {
23  if (group == NULL || *group == 0)
24  return 0;
25 
26  return G_find_file2("group", group, G_mapset()) != NULL;
27 }
28 
29 int I_find_group_file(const char *group, const char *file)
30 {
31  if (!I_find_group(group))
32  return 0;
33  if (file == NULL || *file == 0)
34  return 0;
35 
36  return G_find_file2_misc("group", file, group, G_mapset()) != NULL;
37 }
38 
39 int I_find_subgroup(const char *group, const char *subgroup)
40 {
41  char element[GNAME_MAX];
42 
43  if (!I_find_group(group))
44  return 0;
45  if (subgroup == NULL || *subgroup == 0)
46  return 0;
47 
48  sprintf(element, "subgroup/%s", subgroup);
49 
50  return G_find_file2_misc("group", element, group, G_mapset()) != NULL;
51 }
52 
53 int I_find_subgroup_file(const char *group, const char *subgroup,
54  const char *file)
55 {
56  char element[GNAME_MAX * 2];
57 
58  if (!I_find_group(group))
59  return 0;
60  if (subgroup == NULL || *subgroup == 0)
61  return 0;
62  if (file == NULL || *file == 0)
63  return 0;
64 
65  sprintf(element, "subgroup/%s/%s", subgroup, file);
66 
67  return G_find_file2_misc("group", element, group, G_mapset()) != NULL;
68 }
char * G_mapset(void)
current mapset name
Definition: mapset.c:31
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
char * G_find_file2_misc(const char *dir, const char *element, const char *name, const char *mapset)
Definition: find_file.c:196
int I_find_subgroup(const char *group, const char *subgroup)
Definition: imagery/find.c:39
int I_find_group(const char *group)
does group exist?
Definition: imagery/find.c:21
int I_find_group_file(const char *group, const char *file)
Definition: imagery/find.c:29
return NULL
Definition: dbfopen.c:1394
char * G_find_file2(const char *element, const char *name, const char *mapset)
searches for a file from the mapset search list or in a specified mapset. (look but don&#39;t touch) retu...
Definition: find_file.c:191
#define file
int I_find_subgroup_file(const char *group, const char *subgroup, const char *file)
Definition: imagery/find.c:53