#include "RemoteAgentIF.h"
#include "Task.h"
#include "System.h"
#include "Syslog.h"

int main( int argc, char **argv )
{
    RemoteAgentIF * ra;
    if (argc > 1) {
	try {
	    if (System::findServer(RemoteAgentIFServerName)) {
	      printf("poinker found a RemoteAgentServer\n");
		ra = new RemoteAgentIF("poinker");
		ra->poinkerCommand(argv[1]);
	    }
	    else
	    {
	      printf("poinker - poinker could not locate a RemoteAgentServer\n");
	    }
	}
	catch( SharedObjectClient::MissingServer e ) {
	    printf("poinker -- Could not find RemoteAgentServer. %s\n", e.msg);
	    Syslog::write("poinker -- Could not find RemoteAgentServer.");
	    exit(-1);
	} catch( Exception e ) {
	    printf("Caught while instantiating interface: %s\n", e.msg );
	    Syslog::write("Caught while instantiating interface: %s", e.msg );
	} catch(...) {
	    printf("Caught unknown exception while instantiating interface.\n");
	    Syslog::write("Caught unknown exception while instantiating interface.");
	}
    }
    else
    {
      printf("poinker - poinker needs a command argument\n");
    }

    return 0;
}
