/*-------------------------------------------------------------*/
/*  File:  wproc.c
 *
 *  Demonstrates a work procedure.
 *
 */
/*-------------------------------------------------------------*/
#include <stdio.h>

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Xol/OpenLook.h>

#include <Xol/StaticText.h>

#define MAXCHR 80

static char line[MAXCHR] = "In workproc...";

static void update_time();

XtWorkProcId wp_id;
Boolean do_work();
static int count = 0;
/*-------------------------------------------------------------*/
void main(argc, argv)
int  argc;
char **argv;
{
    Widget      top_level, time_label;

/* Initialize the toolkit and create the top-level widget */
    top_level = OlInitialize(argv[0], "Wproc", NULL, 0,
                               &argc, argv);

/* Set up a StaticText widget to display the time */

    time_label = XtVaCreateManagedWidget("Time", 
                      staticTextWidgetClass, top_level,
                      XtNstring,    "Testing workproc",
                      NULL);

    wp_id = XtAddWorkProc(do_work, "Working...\n");

/* Realize the widgets */
    XtRealizeWidget(top_level);

/* Start the main event-handling loop */
    XtMainLoop();
}
/*-------------------------------------------------------------*/
Boolean do_work(p)
XtPointer p;
{
    printf("%s", (char*)p);
    count++;
    if(count < 100) return False;
    else return True;
}

