#include <stdio.h>
#include <sys/sched.h>
#include <errno.h>
#include "Supervisor.h"
#include "Syslog.h"
#include "VehicleConfigurator.h"

int main(int argc, char **argv)
{
    Supervisor *supervisor = 0;
    char umbrellaDirectoryName[32];

    if ( argc > 1 )
    	strncpy( umbrellaDirectoryName, argv[1], sizeof(umbrellaDirectoryName) );
    else
    	strcpy( umbrellaDirectoryName, "unspecified");

    try {
		supervisor = new Supervisor(umbrellaDirectoryName);
		supervisor->run();
    }
    catch( Exception e ) {
		Syslog::write("Supervisor - Caught: %s", e.msg );
    }
    catch(...) {
		Syslog::write("Supervisor - Unspecified exception on driver execution");
	}

    delete supervisor;

    return 0;
}
