ref: 2d20dee9798613951023bc570104a6f80f0ef628
parent: 117afd8f583f264fe3c24403d9e52c60da76279e
author: Simon Howard <fraggle@gmail.com>
date: Sun Jan 8 13:22:39 EST 2006
Strip carriage returns from the end of lines when reading configuration files. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 276
--- 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>
@@ -524,6 +528,14 @@
// This line doesn't match
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