Mercurial > hg > minc-tools
changeset 2089:a273f2dd7ed0
Ignore carriage return characters so that we can read files written on MS-DOS without complaint
author | bert <bert> |
---|---|
date | Tue, 03 May 2005 19:45:20 +0000 |
parents | dc8bdd36d0f9 |
children | c70d4af7106b |
files | volume_io/MNI_formats/mni_io.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/volume_io/MNI_formats/mni_io.c +++ b/volume_io/MNI_formats/mni_io.c @@ -15,7 +15,7 @@ #include <internal_volume_io.h> #ifndef lint -static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/MNI_formats/mni_io.c,v 1.10.2.1 2004-10-04 20:18:52 bert Exp $"; +static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/MNI_formats/mni_io.c,v 1.10.2.2 2005-05-03 19:45:20 bert Exp $"; #endif static const char COMMENT_CHAR1 = '%'; @@ -57,7 +57,8 @@ in_comment = FALSE; } while( status == OK && - (in_comment || *ch == ' ' || *ch == '\t' || *ch == '\n') ); + (in_comment || *ch == ' ' || *ch == '\t' || *ch == '\n' || + *ch == '\r') ); /* ignore carriage returns */ if( status == ERROR ) status = END_OF_FILE; @@ -133,7 +134,9 @@ while( status == OK && ch != '\n' ) { - concat_char_to_string( string, ch ); + if (ch != '\r') { /* Always ignore carriage returns */ + concat_char_to_string( string, ch ); + } status = input_character( file, &ch ); } @@ -193,7 +196,9 @@ while( status == OK && ch != termination_char1 && ch != termination_char2 && ch != '\n' ) { - concat_char_to_string( string, ch ); + if (ch != '\r') { /* Always ignore carriage returns */ + concat_char_to_string( string, ch ); + } status = input_character( file, &ch ); }