From 2c235f35ab80a663839f78df5201320f0b3c89c5 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Fri, 30 Mar 2007 22:28:34 +0000 Subject: [PATCH] bugfix: escape string parameters on the commandline. For linux, the dollarsign is escaped aswell. Probably needs to check for other OS'es aswell. On MS Windows, no escaping of dollarsign should be performed. --- src/extension/parameter.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/extension/parameter.cpp b/src/extension/parameter.cpp index 7183b9778..3dc0842ec 100644 --- a/src/extension/parameter.cpp +++ b/src/extension/parameter.cpp @@ -6,7 +6,7 @@ * Author: * Ted Gould * - * Copyright (C) 2006 Johan Engelen + * Copyright (C) 2006-2007 Johan Engelen * Copyright (C) 2005-2006 Author * * Released under GNU GPL, read the file 'COPYING' for more information @@ -16,6 +16,9 @@ # include "config.h" #endif +#ifdef linux +# define ESCAPE_DOLLAR_COMMANDLINE +#endif #include #include @@ -898,10 +901,25 @@ ParamFloat::string (void) Glib::ustring * ParamString::string (void) { + gchar * esc = g_strescape(_value, NULL); + Glib::ustring escaped(esc); + g_free(esc); + +#ifdef ESCAPE_DOLLAR_COMMANDLINE // escape the dollar sign + Glib::ustring::iterator i; + for (i = escaped.begin(); i != escaped.end(); ++i) { + if ( *i == '$') { + i = escaped.insert(i, '\\'); + i++; + } + } +#endif + Glib::ustring * mystring = new Glib::ustring(""); *mystring += "\""; - *mystring += _value; + *mystring += escaped; *mystring += "\""; + return mystring; } -- 2.30.2