Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-studio / trunk / src / gtkmm / ipc.cpp
index d8032d1..4d1db56 100644 (file)
@@ -2,10 +2,11 @@
 /*!    \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
@@ -66,6 +67,8 @@
 #include <synfig/string.h>
 #include <glibmm/thread.h>
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -224,8 +227,6 @@ IPC::fifo_path()
 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))
@@ -236,7 +237,6 @@ IPC::fifo_activity(Glib::IOCondition cond)
                        synfig::error("IPC::fifo_activity(): IO_NVAL");
                return false;
        }
-       synfig::info(__FILE__":%d: fifo activity",__LINE__);
 
        String command;
        {
@@ -249,6 +249,7 @@ IPC::fifo_activity(Glib::IOCondition cond)
                } while(tmp!='\n');
        }
 
+       synfig::info("%s:%d: fifo activity: '%s'", __FILE__, __LINE__, command.c_str());
        process_command(command);
        return true;
 }
@@ -259,11 +260,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))
        {
@@ -329,7 +336,7 @@ IPC::make_connection()
                ret=SmartFILE(fdopen(fd,"w"));
 
 #ifdef _DEBUG
-       synfig::info("uplink fd=%d",fd);
+       // synfig::info("uplink fd=%d",fd);
 #endif
 
        return ret;