We know how to extract the button name within the callback.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 14 Sep 2006 02:58:40 +0000 (02:58 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 14 Sep 2006 02:58:40 +0000 (02:58 +0000)
src/xio.c

index 6985cc9a7d01bbde9bc14be26bf6b8e17d75991b..615ea97610ae441b913b12167f2a4e2afd007d4c 100644 (file)
--- 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);
 }