summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2006-01-08 18:22:39 +0000
committerSimon Howard2006-01-08 18:22:39 +0000
commit2d20dee9798613951023bc570104a6f80f0ef628 (patch)
treeabad9f2302a977bfde0b957e9e3a07cbb74cb71b /src
parent117afd8f583f264fe3c24403d9e52c60da76279e (diff)
downloadchocolate-doom-2d20dee9798613951023bc570104a6f80f0ef628.tar.gz
chocolate-doom-2d20dee9798613951023bc570104a6f80f0ef628.tar.bz2
chocolate-doom-2d20dee9798613951023bc570104a6f80f0ef628.zip
Strip carriage returns from the end of lines when reading configuration
files. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 276
Diffstat (limited to 'src')
-rw-r--r--src/m_misc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/m_misc.c b/src/m_misc.c
index 17e5c787..8fc01932 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_misc.c 274 2006-01-08 18:13:33Z fraggle $
+// $Id: m_misc.c 276 2006-01-08 18:22:39Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -23,6 +23,10 @@
//
//
// $Log$
+// Revision 1.15 2006/01/08 18:22:39 fraggle
+// Strip carriage returns from the end of lines when reading configuration
+// files.
+//
// Revision 1.14 2006/01/08 18:13:33 fraggle
// show_endoom config file option to disable the endoom screen
//
@@ -86,7 +90,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: m_misc.c 274 2006-01-08 18:13:33Z fraggle $";
+rcsid[] = "$Id: m_misc.c 276 2006-01-08 18:22:39Z fraggle $";
#include <stdio.h>
#include <stdlib.h>
@@ -525,6 +529,14 @@ static void LoadDefaultCollection(default_collection_t *collection)
continue;
}
+
+ // Strip off trailing non-printable characters (\r characters
+ // from DOS text files)
+
+ while (strlen(strparm) > 0 && !isprint(strparm[strlen(strparm)-1]))
+ {
+ strparm[strlen(strparm)-1] = '\0';
+ }
// Find the setting in the list