All pastes #236206 Raw Edit

Anonymous

public text v1 · immutable
#236206 ·published 2006-11-03 18:02 UTC
rendered paste body
#include <signal.h>
#include <unistd.h>
#include "generic-nms.h"
#include "client-nms.h"
#include "nmsplugin.h"
#include "widgets.h"
#include "fb.h"
#include "application.h"

static void signalInit(void);

static void signal_handler(int signum)
{
    exit(0);
}

static
void signalInit(void)
{
    struct sigaction sa;

        memset(&sa, 0, sizeof(sa));
        sa.sa_handler = signal_handler;

    if (sigaction(SIGINT, &sa, NULL)){}
    if (sigaction(SIGTERM, &sa, NULL)){}
    if (sigaction(SIGQUIT, &sa, NULL)){}
}

int main(int argc, char *argv[]){
    signalInit();
    if (NmsInit())
    {
        printf("NMS initialization failed!\n");
        return 1;
    }
    NmsStart();
    AppCreate();
    printf( "formnew elott\n ");

    printf( "screen_width: %d, screen_height: %d\n", ScreenWidth(), ScreenHeight() );
    FORM *widget = FormNew( 10, 10, SCREEN_WIDTH - 10, SCREEN_HEIGHT - 10 );
    printf( "widgetshow elott...\n ");
    widget_prop_t wprop;
    WidgetGetProp( widget, &wprop );
    wprop.bgcolor=NCC_BLACK;
    wprop.fgcolor=NCC_BLACK;
    WidgetSetProp( widget, wprop );
    WidgetShow(widget,TRUE);
    WidgetFocus(widget,TRUE);

     NmsStopMonitor();
     NmsSetRepeatmode(0);
     NmsSetPlaymode(0);
     SetFrameBufferMode(fmMonitor);
    NmsPlay(0, argv[1]);
    for(;;){
        sleep(1);
    }

    NmsStopPlay();
    exit(1);
}