[GRASS-SVN] r60516 - grass/trunk/general/g.mlist
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 27 08:15:21 PDT 2014
Author: hcho
Date: 2014-05-27 08:15:21 -0700 (Tue, 27 May 2014)
New Revision: 60516
Modified:
grass/trunk/general/g.mlist/main.c
Log:
g.mlist: Use G_open/close_option_file
Modified: grass/trunk/general/g.mlist/main.c
===================================================================
--- grass/trunk/general/g.mlist/main.c 2014-05-27 15:13:54 UTC (rev 60515)
+++ grass/trunk/general/g.mlist/main.c 2014-05-27 15:15:21 UTC (rev 60516)
@@ -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