changeset 87:bf8c97460fd7 noffle

[svn] Preserve newslines and spaces in header lines
author bears
date Thu, 18 May 2000 13:11:05 +0100
parents dfd898776a35
children 1fcdced0246e
files src/util.c src/util.h
diffstat 2 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/util.c	Wed May 17 18:09:04 2000 +0100
+++ b/src/util.c	Thu May 18 13:11:05 2000 +0100
@@ -1,7 +1,7 @@
 /*
   util.c
 
-  $Id: util.c 65 2000-05-12 16:52:41Z enz $
+  $Id: util.c 99 2000-05-18 12:11:05Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -122,25 +122,24 @@
 
     /* Look for followon line if this isn't a blank line. */
     if ( res != NULL && !isspace( result[ 0 ] ) )
-	while ( res != NULL && res[ 0 ] != '\n' && isspace( res[ 0 ] ) )
+	for(;;)
 	{
 	    Str nextLine;
 	    const char *here;
-	    char *next;
 
 	    here = res;
+	    nextLine[ 0 ] = '\0';
 	    res = Utl_getLn( nextLine, res );
-	    next = Utl_stripWhiteSpace( nextLine );
-
-	    if ( next[ 0 ] != '\0' )
+	    if ( res == NULL || nextLine[ 0 ] == '\0'
+		 || !isspace( nextLine[ 0 ] ) )
 	    {
-		Utl_catStr( result, " " );
-		Utl_catStr( result, next );
+		res = here;
+		break;
 	    }
 	    else
 	    {
-		res = here;
-		break;
+		Utl_catStr( result, "\n" );
+		Utl_catStr( result, nextLine );
 	    }
 	}
 
--- a/src/util.h	Wed May 17 18:09:04 2000 +0100
+++ b/src/util.h	Thu May 18 13:11:05 2000 +0100
@@ -3,7 +3,7 @@
 
   Miscellaneous helper functions.
 
-  $Id: util.h 65 2000-05-12 16:52:41Z enz $
+  $Id: util.h 99 2000-05-18 12:11:05Z bears $
 */
 
 #ifndef UTL_H
@@ -51,7 +51,8 @@
 
 /*
   Read a header line from string. Reads continuation lines if
-  necessary. Return NULL if pos == NULL or no more line to read
+  necessary. Line is returned as formatted, including '\n's.
+  Return NULL if pos == NULL or no more line to read.
 */
 const char *
 Utl_getHeaderLn( Str result, const char *p );