# HG changeset patch # User bears # Date 958651865 -3600 # Node ID bf8c97460fd787e9cadbd2e99f6dc4088e2633b7 # Parent dfd898776a3566c48152e74b9b75a4bcf1f064e5 [svn] Preserve newslines and spaces in header lines diff -r dfd898776a35 -r bf8c97460fd7 src/util.c --- 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 ); } } diff -r dfd898776a35 -r bf8c97460fd7 src/util.h --- 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 );