]> git.mxchange.org Git - flightgear.git/commitdiff
strip trailing spaces & garbage
authormfranz <mfranz>
Mon, 13 Jun 2005 19:27:40 +0000 (19:27 +0000)
committermfranz <mfranz>
Mon, 13 Jun 2005 19:27:40 +0000 (19:27 +0000)
src/Main/options.cxx

index b27f37843a756b9925aa02baf0b397f56e57cc19..c1e5ae46dd47ae445c2b43b7a7be8b4ee22e4f74 100644 (file)
@@ -1535,9 +1535,11 @@ fgParseOptions (const string& path) {
 #endif
 
         // catch extraneous (DOS) line ending character
-        if ( line[line.length() - 1] < 32 ) {
-            line = line.substr( 0, line.length()-1 );
-        }
+        int i;
+        for (i = line.length(); i > 0; i--)
+            if (line[i - 1] > 32)
+                break;
+        line = line.substr( 0, i );
 
        if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
             cerr << endl << "Config file parse error: " << path << " '"