1 /* main.c - main() and some logging routines for expect
3 Written by: Don Libes, NIST, 2/6/90
5 Design and implementation of this program was paid for by U.S. tax
6 dollars. Therefore it is public domain. However, the author and NIST
7 would appreciate credit if this program or parts of it are used.
10 /* Don't use stubs since we are in the main application. */
13 #include "expect_cf.h"
16 #include "expect_tcl.h"
27 Tcl_Interp *interp = Tcl_CreateInterp();
28 Tcl_FindExecutable(argv[0]);
30 if (Tcl_Init(interp) == TCL_ERROR) {
31 fprintf(stderr,"Tcl_Init failed: %s\n",Tcl_GetStringResult (interp));
35 if (Expect_Init(interp) == TCL_ERROR) {
36 fprintf(stderr,"Expect_Init failed: %s\n",Tcl_GetStringResult (interp));
40 exp_parse_argv(interp,argc,argv);
42 /* become interactive if requested or "nothing to do" */
44 (void) exp_interpreter(interp,(Tcl_Obj *)0);
46 rc = exp_interpret_cmdfile(interp,exp_cmdfile);
47 else if (exp_cmdfilename)
48 rc = exp_interpret_cmdfilename(interp,exp_cmdfilename);
50 /* assert(exp_cmdlinecmds != 0) */
52 /* SF #439042 -- Allow overide of "exit" by user / script
55 sprintf(buffer, "exit %d", rc);
56 Tcl_Eval(interp, buffer);
58 return 0; /* Needed only to prevent compiler warning. */