Foutje met new-line karakters in een string, precies hetzelfde als bij eval.
This commit is contained in:
		
							parent
							
								
									6d56874b8f
								
							
						
					
					
						commit
						c7beb3208f
					
				
					 1 changed files with 18 additions and 3 deletions
				
			
		|  | @ -6,16 +6,31 @@ | ||||||
| pr_text_with_conversions( str) | pr_text_with_conversions( str) | ||||||
| char *str; | char *str; | ||||||
| { | { | ||||||
| 	char *ptr, *next_conversion(), *pr_conversion(); | 	char *s, *ptr, *next_conversion(), *pr_conversion(); | ||||||
| 
 | 
 | ||||||
|         while (  ptr = next_conversion( str)) { |         while (  ptr = next_conversion( str)) { | ||||||
| 		/* ptr points to '%'-sign */ | 		/* ptr points to '%'-sign */ | ||||||
| 	 	*ptr = '\0'; | 	 	*ptr = '\0'; | ||||||
| 		out( "fprint( outfile, \"%s\");", str); | 
 | ||||||
|  | 		out( "fprint( outfile, \""); | ||||||
|  | 		for ( s = str; *s != '\0'; s++) | ||||||
|  | 			if ( *s == '\n') | ||||||
|  | 				out( "\\n"); | ||||||
|  | 			else | ||||||
|  | 				out( "%c", *s); | ||||||
|  | 		out( "\");"); | ||||||
|  | 
 | ||||||
| 	 	*ptr = '%'; | 	 	*ptr = '%'; | ||||||
| 	        str = pr_conversion( ptr); | 	        str = pr_conversion( ptr); | ||||||
| 	} | 	} | ||||||
| 	out( "fprint( outfile, \"%s\");", str); | 
 | ||||||
|  | 	out( "fprint( outfile, \""); | ||||||
|  | 	for ( s = str; *s != '\0'; s++) | ||||||
|  | 		if ( *s == '\n') | ||||||
|  | 			out( "\\n"); | ||||||
|  | 		else | ||||||
|  | 			out( "%c", *s); | ||||||
|  | 	out( "\");"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| char *next_conversion( str) | char *next_conversion( str) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue