#include <QCoreApplication>
#include "../ytCore/yt_unit_shm.h"
#include "dogthread.h"



YT_UNIT_SHM *ytShm;


bool load_shm()
{
    int shmid;
    key_t key;
    if((key = ftok(SHM_PATH,(int)SHM_PORT))==-1)
        return false;
    if((shmid = shmget(key,sizeof(YT_UNIT_SHM),IPC_CREAT|0666))==-1)
        return false;
    ytShm = (YT_UNIT_SHM *)shmat(shmid,NULL,0);
    return true;
}

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QStringList params;
    if(argc>1)
    {
        for(int i=1;i<argc;i++)
            params.append(QString(argv[i]));
    }
    if(load_shm())
    {
        dogThread *thread = new dogThread(0,params);
        thread->start();
    }

    return a.exec();
}
