Mercurial > noffle
comparison src/util.c @ 87:bf8c97460fd7 noffle
[svn] Preserve newslines and spaces in header lines
author | bears |
---|---|
date | Thu, 18 May 2000 13:11:05 +0100 |
parents | e612b263934f |
children | 93cc929329eb |
comparison
equal
deleted
inserted
replaced
86:dfd898776a35 | 87:bf8c97460fd7 |
---|---|
1 /* | 1 /* |
2 util.c | 2 util.c |
3 | 3 |
4 $Id: util.c 65 2000-05-12 16:52:41Z enz $ | 4 $Id: util.c 99 2000-05-18 12:11:05Z bears $ |
5 */ | 5 */ |
6 | 6 |
7 #if HAVE_CONFIG_H | 7 #if HAVE_CONFIG_H |
8 #include <config.h> | 8 #include <config.h> |
9 #endif | 9 #endif |
120 { | 120 { |
121 const char * res = Utl_getLn( result, p ); | 121 const char * res = Utl_getLn( result, p ); |
122 | 122 |
123 /* Look for followon line if this isn't a blank line. */ | 123 /* Look for followon line if this isn't a blank line. */ |
124 if ( res != NULL && !isspace( result[ 0 ] ) ) | 124 if ( res != NULL && !isspace( result[ 0 ] ) ) |
125 while ( res != NULL && res[ 0 ] != '\n' && isspace( res[ 0 ] ) ) | 125 for(;;) |
126 { | 126 { |
127 Str nextLine; | 127 Str nextLine; |
128 const char *here; | 128 const char *here; |
129 char *next; | |
130 | 129 |
131 here = res; | 130 here = res; |
131 nextLine[ 0 ] = '\0'; | |
132 res = Utl_getLn( nextLine, res ); | 132 res = Utl_getLn( nextLine, res ); |
133 next = Utl_stripWhiteSpace( nextLine ); | 133 if ( res == NULL || nextLine[ 0 ] == '\0' |
134 | 134 || !isspace( nextLine[ 0 ] ) ) |
135 if ( next[ 0 ] != '\0' ) | |
136 { | 135 { |
137 Utl_catStr( result, " " ); | 136 res = here; |
138 Utl_catStr( result, next ); | 137 break; |
139 } | 138 } |
140 else | 139 else |
141 { | 140 { |
142 res = here; | 141 Utl_catStr( result, "\n" ); |
143 break; | 142 Utl_catStr( result, nextLine ); |
144 } | 143 } |
145 } | 144 } |
146 | 145 |
147 return res; | 146 return res; |
148 } | 147 } |