/* 
 * init.c
 *
 * x-kernel v3.3
 *
 * Copyright (c) 1993,1991,1990,1996  Arizona Board of Regents
 *
 * $Revision: 1.5 $
 * $Date: 1996/08/02 16:38:01 $
 */

#include <sys/types.h>
#include <sys/processor.h>
#include <sys/procset.h>
#include <signal.h>

#include <ctype.h>
#include "config.h"
#include "x_stdio.h"
#include "process.h"
#include "upi.h"
#include "xk_debug.h"
#include "event_i.h"
#include "event.h"
#include "compose.h"
#include "platform.h"
#include "prottbl.h"
#include "x_libc.h"
#include "x_util.h"
#include "netmask.h"
#include "rom.h"

int traceinit = 0;

int  globalArgc;
char **globalArgv;
char *rom[ROM_MAX_LINES + 1][ROM_MAX_FIELDS + 1];  

int  traceinit;

static void pgraphStub(Event, void *);

static void
pgraphStub(Event ev, VOID *arg)
{
    build_pgraph();
}

static void
dummyhandler()
{
}

int
main(int argc, char *argv[])
{
    struct sigaction act;

    setbuf(stdout, 0);
    globalArgc = argc;
    globalArgv = argv;

    act.sa_handler = dummyhandler;
    sigemptyset(&act.sa_mask);
    act.sa_flags = 0;
    sigaction(SIGALRM, &act, NULL);

    threadInit();
    xTraceInit();
    initRom();
    map_init();
    /* msgInit(); */
    evInit(EVENT_INTERVAL);
    netMaskInit();
    prottbl_init();
    upiInit();
    xMallocInit();
    build_pgraph_dev();
    evDetach(evSchedule(pgraphStub, 0, 0));
    
    thr_exit(NULL);
    return 0;
}
