GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
color_remove.c
Go to the documentation of this file.
1 
2 /****************************************************************************
3  *
4  * MODULE: gis library
5  * AUTHOR(S): Glynn Clements <glynn@gclements.plus.com>
6  * COPYRIGHT: (C) 2007 Glynn Clements
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  *****************************************************************************/
19 
20 #include <string.h>
21 #include <stdio.h>
22 #include <grass/gis.h>
23 
24 int G_remove_colors(const char *name, const char *mapset)
25 {
26  char element[GMAPSET_MAX + 6];
27  char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
28  int stat;
29 
30  if (G__name_is_fully_qualified(name, xname, xmapset)) {
31  if (strcmp(xmapset, mapset) != 0)
32  return -1;
33  name = xname;
34  }
35 
36  /* get rid of existing colr2, if any */
37  sprintf(element, "colr2/%s", mapset);
38  stat = G_remove(element, name);
39 
40  if (strcmp(mapset, G_mapset()) == 0)
41  stat = G_remove("colr", name);
42 
43  return stat;
44 }
char * G_mapset(void)
current mapset name
Definition: mapset.c:31
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
char xmapset[512]
Definition: g3dcats.c:89
string name
Definition: render.py:1314
int stat
Definition: g3dcolor.c:369
int G_remove(const char *element, const char *name)
Remove a database file.
Definition: remove.c:47
char xname[512]
Definition: g3dcats.c:89
int G_remove_colors(const char *name, const char *mapset)
Definition: color_remove.c:24
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