**
** \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
#include <synfig/string.h>
#include <glibmm/thread.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
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))
{