@@ -185,24 +185,24 @@ int main(int argc, char *argv[]) {
185185
186186 // first find number of changeable parameters:
187187 fgets (line , sizeof (line ), pChange );
188- strtok (line , " \t\n" ); // read and ignore first token -- split on space, tab & newline
188+ strtok (line , " \t\n\r " ); // read and ignore first token -- split on space, tab, newline & carriage return
189189 numChangeableParams = 1 ; // assume at least one changeableParam
190- while (strtok (NULL , " \t\n" ) != NULL ) // now count # of remaining tokens (i.e. # of parameter names)
190+ while (strtok (NULL , " \t\n\r " ) != NULL ) // now count # of remaining tokens (i.e. # of parameter names)
191191 numChangeableParams ++ ;
192192
193193 // now allocate space for array and find the param indices:
194194 indices = (int * )malloc (numChangeableParams * sizeof (int ));
195195 rewind (pChange );
196196 fgets (line , sizeof (line ), pChange );
197- paramName = strtok (line , " \t\n" ); // get the first item
197+ paramName = strtok (line , " \t\n\r " ); // get the first item
198198 for (i = 0 ; i < numChangeableParams ; i ++ ) {
199199 indices [i ] = locateParam (spatialParams , paramName );
200200 if (indices [i ] == -1 ) {
201201 printf ("Invalid parameter '%s'\n" , paramName );
202202 printf ("Please fix first line of %s and re-run\n" , mcParamFile );
203203 exit (1 );
204204 }
205- paramName = strtok (NULL , " \t\n" ); /* get the next item (note: the last time this is called, we'll have paramName = NULL;
205+ paramName = strtok (NULL , " \t\n\r " ); /* get the next item (note: the last time this is called, we'll have paramName = NULL;
206206 that's okay, because we just ignore it */
207207 }
208208
@@ -212,7 +212,7 @@ int main(int argc, char *argv[]) {
212212
213213 runNum = 1 ;
214214 out = NULL ;
215- while ((fgets (line , sizeof (line ), pChange ) != NULL ) && (strcmp (line , "\n" ) != 0 )) {
215+ while ((fgets (line , sizeof (line ), pChange ) != NULL ) && (strcmp (line , "\n" ) != 0 ) && ( strcmp ( line , "\r\n" ) != 0 ) ) {
216216 // get next set of parameter values and do next run
217217
218218 if (doMainOutput ) {
@@ -268,7 +268,7 @@ int main(int argc, char *argv[]) {
268268
269269 for (k = 0 ; k < 2 ; k ++ ) {
270270 runNum = 1 ;
271- while ((fgets (line , sizeof (line ), pChange ) != NULL ) && (strcmp (line , "\n" ) != 0 )) {
271+ while ((fgets (line , sizeof (line ), pChange ) != NULL ) && (strcmp (line , "\n" ) != 0 ) && ( strcmp ( line , "\r\n" ) != 0 ) ) {
272272 // get next set of parameter values and do next run
273273 if (numToSkip > 0 ) {
274274 strtok (line , " \t" ); // read and ignore first value
0 commit comments