GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
nme_in_mps.c
Go to the documentation of this file.
1 
16 #include <string.h>
17 #include <grass/gis.h>
18 
32 #ifndef COMMENTED_OUT
33 int G__name_in_mapset(const char *name_in, char *name_out, char *mapset)
34 {
35  char in[1024];
36 
37  *in = 0;
38  return (sscanf(name_in, "%s %s %s", name_out, in, mapset) == 3 &&
39  strcmp(in, "in") == 0);
40 }
41 #endif
42 
57 int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
58 {
59  const char *p;
60  char *q;
61 
62  /* search for name@mapset */
63 
64  *name = *mapset = 0;
65 
66  for (p = fullname; *p; p++)
67  if (*p == '@')
68  break;
69 
70  if (*p == 0)
71  return 0;
72 
73  /* copy the name part */
74  q = name;
75  while (fullname != p)
76  *q++ = *fullname++;
77  *q = 0;
78 
79  /* copy the mapset part */
80  p++; /* skip the @ */
81  q = mapset;
82  while ((*q++ = *p++)) ;
83 
84  return (*name && *mapset);
85 }
86 
87 
118 char *G_fully_qualified_name(const char *name, const char *mapset)
119 {
120  char fullname[GNAME_MAX + GMAPSET_MAX];
121 
122  if (strchr(name, '@'))
123  sprintf(fullname, "%s", name);
124  else
125  sprintf(fullname, "%s@%s", name, mapset);
126 
127  return G_store(fullname);
128 }
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
char * G_store(const char *s)
Copy string to allocated memory.
Definition: store.c:32
tuple q
Definition: forms.py:2018
string name
Definition: render.py:1305
char * G_fully_qualified_name(const char *name, const char *mapset)
fully qualified file name
Definition: nme_in_mps.c:118
int G__name_in_mapset(const char *name_in, char *name_out, char *mapset)
Checks to see if &#39;name_in&#39; is in the format: &lt;name&gt; in &lt;mapset&gt;
Definition: nme_in_mps.c:33
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