[GRASS-SVN] r51599 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 5 04:58:18 EDT 2012


Author: neteler
Date: 2012-05-05 01:58:18 -0700 (Sat, 05 May 2012)
New Revision: 51599

Modified:
   grass/trunk/lib/gis/gislib.dox
Log:
fix example

Modified: grass/trunk/lib/gis/gislib.dox
===================================================================
--- grass/trunk/lib/gis/gislib.dox	2012-05-05 08:56:35 UTC (rev 51598)
+++ grass/trunk/lib/gis/gislib.dox	2012-05-05 08:58:18 UTC (rev 51599)
@@ -332,21 +332,24 @@
 interfaces with the command-line version of <tt>d.rast</tt>:
 
 \code
+#include <stdlib.h>
 #include <grass/gis.h>
-int main(char *argc, char **argv)
+
+int main(int argc, char *argv[])
 {
- char name[GNAME_MAX], *mapset, *fqn;
- char command[1024];
+    char name[GNAME_MAX], *mapset, *fqn;
+    char command[1024];
 
- G_gisinit(argv[0]);
- mapset = G_ask_cell_old("", name, "");
+    G_gisinit(argv[0]);
+    mapset = G_ask_cell_old("", name);
 
- if (mapset == NULL)
+    if (mapset == NULL)
+        exit(EXIT_SUCCESS);
+
+    fqn = G_fully_qualified_name(name, mapset);
+    sprintf(command, "d.rast map='%s'", fqn);
+    G_spawn(command, "d.rast", NULL);
     exit(EXIT_SUCCESS);
-
- fqn = G_fully_qualified_name(name, mapset);
- sprintf(command, "d.rast map='%s'", fqn);
- G_spawn(command, "d.rast", NULL);
 }
 \endcode
 



More information about the grass-commit mailing list