From 4a44f76516775925def5aee8032ba3457e189b82 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Wed, 17 Jun 2009 08:52:35 +0000 Subject: [PATCH] Change language handling a bit so that seperater includes the new line. Results in slightly larger language file, but it is the easiest way to fix the configuration language stuff. (inspired by bug 2799277 of hiro) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3428 --- src/misc/messages.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/misc/messages.cpp b/src/misc/messages.cpp index 221bbd98..b2ce3d9c 100644 --- a/src/misc/messages.cpp +++ b/src/misc/messages.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: messages.cpp,v 1.22 2009-05-27 09:15:42 qbix79 Exp $ */ +/* $Id: messages.cpp,v 1.23 2009-06-17 08:52:35 qbix79 Exp $ */ #include #include @@ -99,8 +99,11 @@ static void LoadMessageFile(const char * fname) { strcpy(name,linein+1); /* End of string marker */ } else if (linein[0]=='.') { - /* Replace/Add the string to the internal langaugefile */ - MSG_Replace(name,string); + /* Replace/Add the string to the internal langaugefile */ + /* Remove last newline (marker is \n.\n) */ + size_t ll = strlen(string); + if(ll && string[ll - 1] == '\n') string[ll - 1] = 0; //Second if should not be needed, but better be safe. + MSG_Replace(name,string); } else { /* Normal string to be added */ strcat(string,linein); @@ -125,7 +128,7 @@ void MSG_Write(const char * location) { FILE* out=fopen(location,"w+t"); if(out==NULL) return;//maybe an error? for(itmb tel=Lang.begin();tel!=Lang.end();tel++){ - fprintf(out,":%s\n%s.\n",(*tel).name.c_str(),(*tel).val.c_str()); + fprintf(out,":%s\n%s\n.\n",(*tel).name.c_str(),(*tel).val.c_str()); } fclose(out); }