/usr/share/doc/xviewg/examples/notifier/ntfy_sig.c is in xview-examples 3.2p1.4-28.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | /*
* ntfy_sig.c -- shows how to catch signals using the notifier
*/
#include <xview/xview.h>
#include <xview/frame.h>
#include <xview/panel.h>
Frame frame;
Notify_value
sigint_handler(client, sig, when)
Notify_client client;
int sig;
{
printf("Received signal %d\n", sig);
return NOTIFY_DONE;
}
main (argc, argv)
int argc;
char *argv[];
{
Panel panel;
char buf[BUFSIZ];
int n, quit();
xv_init (XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
frame = (Frame)xv_create (NULL, FRAME,
FRAME_LABEL, argv[0],
XV_WIDTH, 200,
XV_HEIGHT, 100,
NULL);
panel = (Panel)xv_create (frame, PANEL, NULL);
(void) xv_create (panel, PANEL_BUTTON,
PANEL_LABEL_STRING, "Quit",
PANEL_NOTIFY_PROC, quit,
NULL);
notify_set_signal_func(frame, sigint_handler, SIGINT, NOTIFY_ASYNC);
xv_main_loop(frame);
}
int
quit()
{
xv_destroy_safe(frame);
return XV_OK;
}
|