The first truly batch version of xcircuit implemented for the
[xcircuit.git] / xcircdnull.c
blobdffbbd6609b397151e842b19f690a6679e288b87
1 /*----------------------------------------------------------------------*/
2 /* xcircdnull.c */
3 /* */
4 /* See comments for "xcircexec.c". This has the same function as */
5 /* xcircexec.c, but does not initialize the Tk package. This avoids */
6 /* problems attempting to run in an environment without a DISPLAY */
7 /* variable set (true batch mode). */
8 /*----------------------------------------------------------------------*/
10 #include <stdio.h>
12 #include <tcl.h>
14 /*----------------------------------------------------------------------*/
15 /* Application initiation. This is exactly like the AppInit routine */
16 /* for "wish", minus the cruft, but with "tcl_rcFileName" set to */
17 /* "xcircuit.tcl" instead of "~/.wishrc". */
18 /*----------------------------------------------------------------------*/
20 int
21 xcircuit_AppInit(interp)
22 Tcl_Interp *interp;
24 if (Tcl_Init(interp) == TCL_ERROR) {
25 return TCL_ERROR;
27 Tcl_StaticPackage(interp, "Tcl", Tcl_Init, Tcl_Init);
29 /* This is where we replace the home ".tclshrc" file with */
30 /* xcircuit's startup script. */
32 Tcl_SetVar(interp, "tcl_rcFileName", SCRIPTS_DIR "/xcircuit.tcl",
33 TCL_GLOBAL_ONLY);
35 /* Additional variable can be used to tell if xcircuit is in batch mode */
36 Tcl_SetVar(interp, "batch_mode", "true", TCL_GLOBAL_ONLY);
38 return TCL_OK;
41 /*----------------------------------------------------------------------*/
42 /* The main procedure; replacement for "wish". */
43 /*----------------------------------------------------------------------*/
45 int
46 main(argc, argv)
47 int argc;
48 char **argv;
50 Tcl_Main(argc, argv, xcircuit_AppInit);
51 return 0;
54 /*----------------------------------------------------------------------*/