From 4823bf1766c5bed460462e61bcf4ddabaaabaf17 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 14 Sep 2006 02:58:40 +0000 Subject: [PATCH] We know how to extract the button name within the callback. --- src/xio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/xio.c b/src/xio.c index 6985cc9..615ea97 100644 --- a/src/xio.c +++ b/src/xio.c @@ -39,6 +39,7 @@ static void noargs_proc(Widget w, XtPointer client_data, XtPointer call_data) /* use this for commands that take no arguments */ { /* currently a stub */ + printf("Button %s pressed\n", XtName(w)); } static struct cmd_t commands[] = { @@ -80,7 +81,7 @@ static struct cmd_t commands[] = { #define MAXWIDTH 640 #define TEXTHEIGHT 200 -int main(int argc, char **argv) +static void instantiate_main(int argc, char **argv) { struct cmd_t *cp; @@ -158,5 +159,10 @@ int main(int argc, char **argv) XtAppMainLoop(app_context); /* loop may be interrupted */ XtDestroyApplicationContext(app_context); +} + +int main(int argc, char **argv) +{ + instantiate_main(argc, argv); exit(0); } -- 2.31.1