summaryrefslogtreecommitdiff
path: root/qrouterexec.c
diff options
context:
space:
mode:
authorTim Edwards <tim@opencircuitdesign.com>2014-09-16 10:20:18 -0400
committerTim Edwards <tim@opencircuitdesign.com>2014-09-16 10:20:18 -0400
commit5dc5691ea246a85d546f3c1ff01fd13279731bd2 (patch)
tree233bf593f254f5525eaa4249d094b6dac4440004 /qrouterexec.c
Initial commit at Tue Sep 16 10:20:18 EDT 2014 by tim on stravinsky.tim.linglan.net
Diffstat (limited to 'qrouterexec.c')
-rw-r--r--qrouterexec.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/qrouterexec.c b/qrouterexec.c
new file mode 100644
index 0000000..67cc8ea
--- /dev/null
+++ b/qrouterexec.c
@@ -0,0 +1,49 @@
+/*----------------------------------------------------------------------*/
+/* qrouterexec.c */
+/*----------------------------------------------------------------------*/
+
+#include <stdio.h>
+
+#include <tk.h>
+#include <tcl.h>
+
+/*----------------------------------------------------------------------*/
+/* Application initiation. This is exactly like the AppInit routine */
+/* for "wish", minus the cruft, but with "tcl_rcFileName" set to */
+/* "qrouter.tcl" instead of "~/.wishrc". */
+/*----------------------------------------------------------------------*/
+
+int
+qrouter_AppInit(interp)
+ Tcl_Interp *interp;
+{
+ if (Tcl_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (Tk_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
+
+ /* This is where we replace the home ".wishrc" file with */
+ /* qrouter's startup script. */
+
+ Tcl_SetVar(interp, "tcl_rcFileName", QROUTER_PATH "/qrouter.tcl",
+ TCL_GLOBAL_ONLY);
+ return TCL_OK;
+}
+
+/*----------------------------------------------------------------------*/
+/* The main procedure; replacement for "wish". */
+/*----------------------------------------------------------------------*/
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ Tk_Main(argc, argv, qrouter_AppInit);
+ return 0;
+}
+
+/*----------------------------------------------------------------------*/