From: Eric S. Raymond Date: Thu, 14 Sep 2006 02:58:40 +0000 (+0000) Subject: We know how to extract the button name within the callback. X-Git-Tag: 2.0~273 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=4823bf1766c5bed460462e61bcf4ddabaaabaf17;p=super-star-trek.git We know how to extract the button name within the callback. --- 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); }