5748570 [rkeene@sledge /home/rkeene/devel/old/tcls]$ cat -n tcls.c
 1 #ifdef USE_TCLX
 2 #include <tclExtend.h>
 3 #endif
 4 #include <tcl.h>
 5 #include <stdlib.h>
 6 
 7 int main(int argc, char **argv) {
 8         char *Tcl_argv;
 9     char *tcl_sourceit;
10     int small=0;
11         Tcl_Interp *interp;
12     if (argc<2) {
13         return(printf("Usage: %s [-s] <filename>\n", argv[0]));
14     }
15     if (!strcmp(argv[1],"-s")) small=1;
16     tcl_sourceit=malloc(strlen(argv[1+small])+8);
17     sprintf(tcl_sourceit, "source %s",argv[1+small]);
18         interp=Tcl_CreateInterp();
19     if (small==0) {
20             Tcl_Init(interp);
21 #ifdef USE_TCLX
22             Tclx_Init(interp);
23 #endif
24     }
25         Tcl_argv=Tcl_Merge(argc-(2+small), argv+(2+small));
26         Tcl_SetVar(interp, "argv", Tcl_argv, TCL_GLOBAL_ONLY);
27         Tcl_SetVar(interp, "argv0", argv[1+small], TCL_GLOBAL_ONLY);
28         Tcl_Eval(interp, tcl_sourceit);
29         return(0);
30 }
5748571 [rkeene@sledge /home/rkeene/devel/old/tcls]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2000-03-25 16:44:00