resetting manifest requested domain to floor
[platform/upstream/expect.git] / exp_main_exp.c
1 /* main.c - main() and some logging routines for expect
2
3 Written by: Don Libes, NIST, 2/6/90
4
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.
8 */
9
10 /* Don't use stubs since we are in the main application. */
11 #undef USE_TCL_STUBS
12
13 #include "expect_cf.h"
14 #include <stdio.h>
15 #include "tcl.h"
16 #include "expect_tcl.h"
17 #include <stdlib.h>
18
19 int
20 main(argc, argv)
21 int argc;
22 char *argv[];
23 {
24         int rc = 0;
25         char buffer [30];
26
27         Tcl_Interp *interp = Tcl_CreateInterp();
28         Tcl_FindExecutable(argv[0]);
29
30         if (Tcl_Init(interp) == TCL_ERROR) {
31             fprintf(stderr,"Tcl_Init failed: %s\n",Tcl_GetStringResult (interp));
32             (void) exit(1);
33         }
34
35         if (Expect_Init(interp) == TCL_ERROR) {
36             fprintf(stderr,"Expect_Init failed: %s\n",Tcl_GetStringResult (interp));
37             (void) exit(1);
38         }
39
40         exp_parse_argv(interp,argc,argv);
41
42         /* become interactive if requested or "nothing to do" */
43         if (exp_interactive)
44                 (void) exp_interpreter(interp,(Tcl_Obj *)0);
45         else if (exp_cmdfile)
46                 rc = exp_interpret_cmdfile(interp,exp_cmdfile);
47         else if (exp_cmdfilename)
48                 rc = exp_interpret_cmdfilename(interp,exp_cmdfilename);
49
50         /* assert(exp_cmdlinecmds != 0) */
51
52         /* SF #439042 -- Allow overide of "exit" by user / script
53          */
54
55         sprintf(buffer, "exit %d", rc);
56         Tcl_Eval(interp, buffer); 
57         /*NOTREACHED*/
58         return 0;               /* Needed only to prevent compiler warning. */
59 }
60