[GRASS-SVN] r43531 - grass/branches/develbranch_6/raster/r.out.mpeg

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 19 21:11:59 EDT 2010


Author: hamish
Date: 2010-09-20 01:11:59 +0000 (Mon, 20 Sep 2010)
New Revision: 43531

Modified:
   grass/branches/develbranch_6/raster/r.out.mpeg/main.c
   grass/branches/develbranch_6/raster/r.out.mpeg/write.c
Log:
remove some unixisms

Modified: grass/branches/develbranch_6/raster/r.out.mpeg/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.out.mpeg/main.c	2010-09-20 00:55:02 UTC (rev 43530)
+++ grass/branches/develbranch_6/raster/r.out.mpeg/main.c	2010-09-20 01:11:59 UTC (rev 43531)
@@ -273,10 +273,13 @@
     write_params(mpfilename, yfiles, outfile, cnt, quality, y_rows, y_cols,
 		 0);
 
+/* FIXME: use G_spawn() as mpfilename may contain spaces */
+/* FIXME: redirect stderr to G_DEV_NULL work on wingrass? */
     if (quiet)
-	sprintf(cmd, "%s %s 2> /dev/null > /dev/null", encoder, mpfilename);
+	sprintf(cmd, "%s \"%s\" 2> %s > %s", encoder, mpfilename, G_DEV_NULL
+		G_DEV_NULL);
     else
-	sprintf(cmd, "%s %s", encoder, mpfilename);
+	sprintf(cmd, "%s \"%s\"", encoder, mpfilename);
 
     if (0 != G_system(cmd))
 	G_warning(_("mpeg_encode ERROR"));
@@ -303,10 +306,13 @@
     mpfilename = G_tempfile();
     write_params(mpfilename, vfiles[0], outfile, frames, quality, 0, 0, 1);
 
+/* FIXME: use G_spawn() as mpfilename may contain spaces */
+/* FIXME: redirect stderr to G_DEV_NULL work on wingrass? */
     if (quiet)
-	sprintf(cmd, "%s %s 2> /dev/null > /dev/null", encoder, mpfilename);
+	sprintf(cmd, "%s \"%s\" 2> %s > %s", encoder, mpfilename, G_DEV_NULL,
+		G_DEV_NULL);
     else
-	sprintf(cmd, "%s %s", encoder, mpfilename);
+	sprintf(cmd, "%s \"%s\"", encoder, mpfilename);
 
     if (0 != G_system(cmd))
 	G_warning(_("mpeg_encode ERROR"));
@@ -335,6 +341,7 @@
 	    mapset = G_mapset();
 
 	G__file_name(path, element, "", mapset);
+/* FIXME: rm UNIXisms (see g.[m]list for hints) */
 	if (access(path, 0) == 0) {
 	    sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null",
 		    path, wildarg, tfile);
@@ -361,8 +368,7 @@
     }
 
     *num = cnt;
-    sprintf(cmd, "\\rm %s", tfile);
-    G_system(cmd);
+    unlink(tfile);
     G_free(tfile);
 
     return (newfiles);
@@ -381,8 +387,8 @@
     int i, j, k, numi, wildnum;
 
     module = G_define_module();
-    module->keywords = _("raster");
-    module->description = _("Raster File Series to MPEG Conversion Program.");
+    module->keywords = _("raster, animation");
+    module->description = _("Raster File Series to MPEG Conversion.");
 
     *numviews = *numframes = 0;
     for (i = 0; i < MAXVIEWS; i++) {
@@ -421,12 +427,13 @@
 
     conv = G_define_flag();
     conv->key = 'c';
-    conv->description =
-	_("Convert on the fly, use less disk space\n\t(requires r.out.ppm with stdout option)");
+    conv->label = _("Convert on the fly, uses less disk space");
+    conv->description =	_("(requires r.out.ppm with stdout option)");
 
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
+
     *convert = 0;
     if (qt->answer)
 	quiet = 1;
@@ -469,6 +476,3 @@
     }
 }
 
-/*********************************************************************/
-
-/*********************************************************************/

Modified: grass/branches/develbranch_6/raster/r.out.mpeg/write.c
===================================================================
--- grass/branches/develbranch_6/raster/r.out.mpeg/write.c	2010-09-20 00:55:02 UTC (rev 43530)
+++ grass/branches/develbranch_6/raster/r.out.mpeg/write.c	2010-09-20 01:11:59 UTC (rev 43531)
@@ -326,18 +326,11 @@
 /*******************************************************/
 void clean_files(char *file, char *files[], int num)
 {
-    char cmd[1000];
     int i;
 
-    sprintf(cmd, "\\rm %s", file);
-    G_system(cmd);
+    unlink(file);
 
-    for (i = 0; i < num; i++) {
-	sprintf(cmd, "\\rm %s", files[i]);
-	G_system(cmd);
-    }
-}
+    for (i = 0; i < num; i++)
+	unlink(files[i]);
 
-/*******************************************************/
-
-/*******************************************************/
+}



More information about the grass-commit mailing list