[GRASS-CVS] markus: grass6/lib/gis getl.c,2.6,2.6.2.1

grass at intevation.de grass at intevation.de
Fri Nov 23 08:16:46 EST 2007


Author: markus

Update of /grassrepository/grass6/lib/gis
In directory doto:/tmp/cvs-serv15139

Modified Files:
      Tag: releasebranch_6_3
	getl.c 
Log Message:
Include trailing NUL in buffer size
Use \r,\n instead of octal constants (merge from HEAD)


Index: getl.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/getl.c,v
retrieving revision 2.6
retrieving revision 2.6.2.1
diff -u -d -r2.6 -r2.6.2.1
--- getl.c	12 Nov 2006 04:05:02 -0000	2.6
+++ getl.c	23 Nov 2007 13:16:44 -0000	2.6.2.1
@@ -55,7 +55,7 @@
     int c;
     int ret = 1;
 
-    while ( i < n  ) {
+    while ( i < n - 1 ) {
 	c = fgetc(fd);
 
 	if ( c == EOF ) { 
@@ -65,11 +65,11 @@
 	    break;
 	}
 	
-	if ( c == '\012' ) break;               /* UNIX */
+	if ( c == '\n' ) break;               /* UNIX */
 
-	if ( c == '\015' ) {                    /* DOS or MacOS9 */
+	if ( c == '\r' ) {                    /* DOS or MacOS9 */
             if ( (c = fgetc(fd) ) != EOF ) {     
-		if ( c != '\012' ) {            /* MacOS9 - we have to return the char to stream */
+		if ( c != '\n' ) {            /* MacOS9 - we have to return the char to stream */
 		    ungetc ( c, fd );
 		}
 	    }




More information about the grass-commit mailing list