[GRASS-dev] G_getl2() with stdin?

what's the point of using G_getl2() with stdin?

are we about to see a new file= option for r.reclass input? :slight_smile:

Hamish

===================================================================
RCS file: /home/grass/grassrepository/grass6/raster/r.reclass/input.c,v
retrieving revision 2.1
retrieving revision 2.1.4.1
diff -u -r2.1 -r2.1.4.1
--- grass6/raster/r.reclass/input.c 2005/07/13 15:52:54 2.1
+++ grass6/raster/r.reclass/input.c 2007/05/16 07:14:32 2.1.4.1
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <grass/gis.h>

int
input (char *buf)
@@ -8,7 +9,7 @@
     char temp1[10], temp2[2];
     if (isatty(0))
   fprintf (stdout,"> ");
- if(!fgets(buf,1024,stdin))
+ if(!G_getl2 (buf, 1024, stdin))
   return 0;
     if (sscanf (buf, "%5s%1s",temp1,temp2)==1 &&
         strcmp (temp1,"end")==0) return 0;

Hi Hamish,

2007/5/16, Hamish <hamish_nospam@yahoo.com>:

what's the point of using G_getl2() with stdin?

the module failed to read rules from the file in DOS format (e.g.)

r.reclass in= out= < file

are we about to see a new file= option for r.reclass input? :slight_smile:

exactly, see my next e-mail :slight_smile:

Martin

Hamish

===================================================================
RCS file: /home/grass/grassrepository/grass6/raster/r.reclass/input.c,v
retrieving revision 2.1
retrieving revision 2.1.4.1
diff -u -r2.1 -r2.1.4.1
--- grass6/raster/r.reclass/input.c 2005/07/13 15:52:54 2.1
+++ grass6/raster/r.reclass/input.c 2007/05/16 07:14:32 2.1.4.1
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <grass/gis.h>

int
input (char *buf)
@@ -8,7 +9,7 @@
     char temp1[10], temp2[2];
     if (isatty(0))
        fprintf (stdout,"> ");
- if(!fgets(buf,1024,stdin))
+ if(!G_getl2 (buf, 1024, stdin))
        return 0;
     if (sscanf (buf, "%5s%1s",temp1,temp2)==1 &&
         strcmp (temp1,"end")==0) return 0;

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *