X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsdlemu_config.cpp;h=aa971c1c92c287094c7b492176edc1b905001d0e;hb=f0e50fb1d23805881b72d51ea603be78b645ec97;hp=9d389218a4528ed9e89ff371dc00d6d82c5ab55e;hpb=f3a7d2b1f420e63525039b776a1d9ffb2a86af85;p=virtualjaguar diff --git a/src/sdlemu_config.cpp b/src/sdlemu_config.cpp index 9d38921..aa971c1 100644 --- a/src/sdlemu_config.cpp +++ b/src/sdlemu_config.cpp @@ -16,11 +16,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include + +#include "sdlemu_config.h" + +#include // For atoi() +#include // For fopen() and friends +#include // For strcmp() #include #include -#include "sdlemu_config.h" using namespace std; @@ -48,7 +51,7 @@ void string_tokenize_variable() for(p = vec.begin(); p != vec.end(); p++) { string::size_type lastPos = (*p).LineName().find_first_not_of(delim, 0); string::size_type pos = (*p).LineName().find_first_of(delim, lastPos); - + if(string::npos != pos && string::npos != lastPos) { string s = (*p).LineName().substr(lastPos, pos - lastPos); (*p).add_token_variable(s); @@ -59,12 +62,12 @@ void string_tokenize_variable() void string_tokenize_value() { list::iterator p; - const string delim = " =\n\t"; - + const string delim = " =\n\t\r"; // "\r" needed for Win32 compatibility... + for(p = vec.begin(); p != vec.end(); p++) { string::size_type lastPos = (*p).LineName().find_first_of(delim, 0); string::size_type pos = (*p).LineName().find_first_not_of(delim, lastPos); - + if(string::npos != pos && string::npos != lastPos) { string s = (*p).LineName().substr(pos); (*p).add_token_value(s); @@ -84,11 +87,11 @@ int sdlemu_init_config(const char *filename) char *s = new char[len]; fread(s, 1, len, f); string str(s); - - const string delim = "\n"; + + const string delim = "\n\r"; // "\r" needed for Win32 compatibility... string::size_type lastPos = str.find_first_not_of(delim, 0); string::size_type pos = str.find_first_of(delim, lastPos); - + while (string::npos != pos || string::npos != lastPos) { string string = str.substr(lastPos, pos - lastPos); if(string[0] == '#')