/*! \file ipc.cpp
** \brief Template File
**
-** $Id: ipc.cpp,v 1.6 2005/01/16 19:55:57 darco Exp $
+** $Id$
**
** \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 =========================================================== */
bool
IPC::fifo_activity(Glib::IOCondition cond)
{
- synfig::info(__FILE__":%d: fifo activity",__LINE__);
-
if(cond&(Glib::IO_ERR|Glib::IO_HUP|Glib::IO_NVAL))
{
if(cond&(Glib::IO_ERR))
synfig::error("IPC::fifo_activity(): IO_NVAL");
return false;
}
- synfig::info(__FILE__":%d: fifo activity",__LINE__);
String command;
{
} while(tmp!='\n');
}
+ synfig::info("%s:%d: fifo activity: '%s'", __FILE__, __LINE__, command.c_str());
process_command(command);
return true;
}
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))
{
ret=SmartFILE(fdopen(fd,"w"));
#ifdef _DEBUG
- synfig::info("uplink fd=%d",fd);
+ // synfig::info("uplink fd=%d",fd);
#endif
return ret;