GRASS Programmer's Manual
6.4.1(2011)
|
00001 00002 /**************************************************************************** 00003 * 00004 * MODULE: gis library 00005 * AUTHOR(S): Glynn Clements <glynn@gclements.plus.com> 00006 * COPYRIGHT: (C) 2007 Glynn Clements 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 *****************************************************************************/ 00019 00020 #include <string.h> 00021 #include <stdio.h> 00022 #include <grass/gis.h> 00023 00024 int G_remove_colors(const char *name, const char *mapset) 00025 { 00026 char element[GMAPSET_MAX + 6]; 00027 char xname[GNAME_MAX], xmapset[GMAPSET_MAX]; 00028 int stat; 00029 00030 if (G__name_is_fully_qualified(name, xname, xmapset)) { 00031 if (strcmp(xmapset, mapset) != 0) 00032 return -1; 00033 name = xname; 00034 } 00035 00036 /* get rid of existing colr2, if any */ 00037 sprintf(element, "colr2/%s", mapset); 00038 stat = G_remove(element, name); 00039 00040 if (strcmp(mapset, G_mapset()) == 0) 00041 stat = G_remove("colr", name); 00042 00043 return stat; 00044 }