X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fipc.cpp;h=4c9797fb9031a81f1b6be00c8b1d2bd26b230726;hb=383d977ef1a85b4b8085cdcf8390b0c22c24989b;hp=ab6748be1bcec1d25d8882a347ba99d8c3b0a5e5;hpb=587ff98fbfd1248c1dd2c440ff59aa9a40b90277;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/ipc.cpp b/synfig-studio/trunk/src/gtkmm/ipc.cpp index ab6748b..4c9797f 100644 --- a/synfig-studio/trunk/src/gtkmm/ipc.cpp +++ b/synfig-studio/trunk/src/gtkmm/ipc.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -66,6 +67,8 @@ #include #include +#include "general.h" + #endif /* === U S I N G =========================================================== */ @@ -259,11 +262,17 @@ IPC::process_command(const synfig::String& command_line) if(command_line.empty()) return false; - char cmd=command_line[0]; + char cmd = command_line[0]; String args(command_line.begin()+1,command_line.end()); - while(!args.empty() && args[0]==' ') args.erase(args.begin()); - while(!args.empty() && args[args.size()-1]=='\n' || args[args.size()-1]==' ') args.erase(args.end()-1); + + // erase leading spaces + while (!args.empty() && args[0] == ' ') + args.erase(args.begin()); + + // erase trailing newlines and spaces + while (!args.empty() && (args[args.size()-1] == '\n' || args[args.size()-1] == ' ')) + args.erase(args.end()-1); switch(toupper(cmd)) {