[GRASS-SVN] r40776 - in grass/trunk: include lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 1 18:28:54 EST 2010


Author: glynn
Date: 2010-02-01 18:28:54 -0500 (Mon, 01 Feb 2010)
New Revision: 40776

Modified:
   grass/trunk/include/gisdefs.h
   grass/trunk/lib/gis/pager.c
   grass/trunk/lib/gis/popen.c
Log:
Fix pager/mail functions


Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h	2010-02-01 23:28:01 UTC (rev 40775)
+++ grass/trunk/include/gisdefs.h	2010-02-01 23:28:54 UTC (rev 40776)
@@ -483,6 +483,7 @@
 void G_unset_percent_routine(void);
 
 /* popen.c */
+void G_popen_clear(struct Popen *);
 FILE *G_popen_write(struct Popen *, const char *, const char **);
 FILE *G_popen_read(struct Popen *, const char *, const char **);
 void G_popen_close(struct Popen *);

Modified: grass/trunk/lib/gis/pager.c
===================================================================
--- grass/trunk/lib/gis/pager.c	2010-02-01 23:28:01 UTC (rev 40775)
+++ grass/trunk/lib/gis/pager.c	2010-02-01 23:28:54 UTC (rev 40776)
@@ -15,6 +15,8 @@
     const char *program = getenv("GRASS_PAGER");
     FILE *fp;
 
+    G_popen_clear(pager);
+
     if (!program)
 	return stdout;
 
@@ -46,6 +48,8 @@
     const char *argv[3];
     FILE *fp;
 
+    G_popen_clear(mail);
+
     if (!user || !*user)
 	return NULL;
 

Modified: grass/trunk/lib/gis/popen.c
===================================================================
--- grass/trunk/lib/gis/popen.c	2010-02-01 23:28:01 UTC (rev 40775)
+++ grass/trunk/lib/gis/popen.c	2010-02-01 23:28:54 UTC (rev 40776)
@@ -50,6 +50,12 @@
     return state->fp;
 }
 
+void G_popen_clear(struct Popen *state)
+{
+    state->fp = NULL;
+    state->pid = -1;
+}
+
 FILE *G_popen_write(struct Popen *state, const char *program, const char **args)
 {
     return do_popen(state, 1, program, args);



More information about the grass-commit mailing list