[GRASS5] Driver Update

Glynn Clements glynn.clements at virgin.net
Wed Apr 25 13:41:49 EDT 2001


Glynn Clements wrote:

> > I'm using your new code with the fprintf()'s so since nothing was
> > printed it must be the get_command() function. ... wait ... Just checked
> > to be sure and yep it's the get_command() function.
> 
> Odd. That one doesn't generate an error because that's how the loop
> normally terminates. However, the input functions which get_command()
> uses might be mistaken in their detection of EOF.
> 
> This certainly narrows it down a bit, though.

Can you get the latest version of lib/command.c (or apply the attached
patch) to narrow it down a bit more.

-- 
Glynn Clements <glynn.clements at virgin.net>

-------------- next part --------------
Index: lib/command.c
===================================================================
RCS file: /grassrepository/grass/src/display/devices/lib/Attic/command.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 command.c
--- lib/command.c	2001/04/21 15:51:20	1.1.2.1
+++ lib/command.c	2001/04/25 17:38:35
@@ -514,6 +514,8 @@
     {
         atbuf = 0;
         n_read = read(_rfd, inbuf, sizeof inbuf);
+	if (n_read < 0)
+	    perror("Monitor: read1: Error reading input");
         if (n_read <= 0)
             return 1;           /* EOF */
     }
@@ -539,7 +541,10 @@
             continue;
         while (*c == COMMAND_ESC)
             if (read1(c) != 0)
+	    {
+		fprintf(stderr, "Monitor: get_command: Premature EOF");
                 return 1;               /* EOF */
+	    }
         if (*c)
             return 0;           /* got the command token */
     }


More information about the grass-dev mailing list