[GRASS-SVN] r45072 - in grass/branches/develbranch_6: include
lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 17 15:59:56 EST 2011
Author: martinl
Date: 2011-01-17 12:59:56 -0800 (Mon, 17 Jan 2011)
New Revision: 45072
Modified:
grass/branches/develbranch_6/include/gisdefs.h
grass/branches/develbranch_6/lib/gis/nme_in_mps.c
Log:
backport G_unqualified_name() - use in g.findfile
Modified: grass/branches/develbranch_6/include/gisdefs.h
===================================================================
--- grass/branches/develbranch_6/include/gisdefs.h 2011-01-17 19:02:52 UTC (rev 45071)
+++ grass/branches/develbranch_6/include/gisdefs.h 2011-01-17 20:59:56 UTC (rev 45072)
@@ -813,6 +813,7 @@
int G__name_in_mapset(const char *, char *, char *);
int G__name_is_fully_qualified(const char *, char *, char *);
char *G_fully_qualified_name(const char *, const char *);
+int G_unqualified_name(const char *, const char *, char *, char *);
/* null_val.c */
void G__set_null_value(void *, int, int, RASTER_MAP_TYPE);
Modified: grass/branches/develbranch_6/lib/gis/nme_in_mps.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/nme_in_mps.c 2011-01-17 19:02:52 UTC (rev 45071)
+++ grass/branches/develbranch_6/lib/gis/nme_in_mps.c 2011-01-17 20:59:56 UTC (rev 45072)
@@ -126,3 +126,37 @@
return G_store(fullname);
}
+
+/*!
+ \brief Returns unqualified map name (without @ mapset)
+
+ Returns an unqualified name for the file <i>name</i> in
+ <i>mapset</i>.
+
+ Note:
+ - <i>name, xname</i> are char array of size GNAME_MAX
+ - <i>mapset, xmapset</i> are char array of size GMAPSET_MAX
+
+ \param fullname map name
+ \param fullname map mapset
+ \param[out] name map name
+ \param[out] mapset mapset name
+
+ \return 1 if input map name is fully qualified
+ \return 0 if ...
+ \return -1 if input mapset invalid
+ */
+int G_unqualified_name(const char *name, const char *mapset,
+ char *xname, char *xmapset)
+{
+ if (G__name_is_fully_qualified(name, xname, xmapset)) {
+ if (mapset && *mapset && strcmp(mapset, xmapset) != 0)
+ return -1;
+ return 1;
+ }
+
+ strcpy(xname, name);
+ strcpy(xmapset, mapset);
+
+ return 0;
+}
More information about the grass-commit
mailing list