[GRASS-SVN] r60740 - grass/branches/releasebranch_7_0/general/g.mlist

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jun 8 01:51:09 PDT 2014


Author: martinl
Date: 2014-06-08 01:51:09 -0700 (Sun, 08 Jun 2014)
New Revision: 60740

Modified:
   grass/branches/releasebranch_7_0/general/g.mlist/main.c
Log:
hcho:  g.mlist: Use G_open/close_option_file
       (merge r60516 from trunk)


Modified: grass/branches/releasebranch_7_0/general/g.mlist/main.c
===================================================================
--- grass/branches/releasebranch_7_0/general/g.mlist/main.c	2014-06-08 08:49:54 UTC (rev 60739)
+++ grass/branches/releasebranch_7_0/general/g.mlist/main.c	2014-06-08 08:51:09 UTC (rev 60740)
@@ -170,12 +170,8 @@
     }
 
     separator = G_option_to_separator(opt.separator);
+    fp = G_open_option_file(opt.output);
 
-    if (!opt.output->answer || strcmp(opt.output->answer, "-") == 0)
-	fp = stdout;
-    else if ((fp = fopen(opt.output->answer, "w")) == NULL)
-	G_fatal_error(_("Failed to create file [%s]"), opt.output->answer);
-
     if ((mapset = opt.mapset->answer) == NULL)
 	mapset = "";
     else if (strcmp(mapset, ".") == 0)
@@ -223,8 +219,7 @@
     if (any)
 	fprintf(fp, "\n");
 
-    if (fp != stdout)
-	fclose(fp);
+    G_close_option_file(fp);
 
     if (filter)
 	G_free_ls_filter(filter);



More information about the grass-commit mailing list