OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [expect/] [exp_main_exp.c] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* 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
#include "expect_cf.h"
11
#include <stdio.h>
12
#include "tcl.h"
13
#ifdef USE_ITCL
14
#include "itcl.h"
15
#endif
16
#include "expect_tcl.h"
17
 
18
int
19
main(argc, argv)
20
int argc;
21
char *argv[];
22
{
23
        int rc = 0;
24
        Tcl_Interp *interp = Tcl_CreateInterp();
25
 
26
        /* need this for [info nameofexecutable] to work */
27
        Tcl_FindExecutable (argv[0]);
28
 
29
        if (Tcl_Init(interp) == TCL_ERROR) {
30
                fprintf(stderr,"Tcl_Init failed: %s\n",interp->result);
31
                exit(1);
32
        }
33
        if (Expect_Init(interp) == TCL_ERROR) {
34
                fprintf(stderr,"Expect_Init failed: %s\n",interp->result);
35
                exit(1);
36
        }
37
 
38
#ifdef USE_ITCL
39
       if (Itcl_Init(interp) == TCL_ERROR) {
40
               fprintf(stderr,"Itcl_Init failed: %s\n",interp->result);
41
               exit(1);
42
       }
43
#endif
44
        exp_parse_argv(interp,argc,argv);
45
 
46
        /* become interactive if requested or "nothing to do" */
47
        if (exp_interactive)
48
                (void) exp_interpreter(interp);
49
        else if (exp_cmdfile)
50
                rc = exp_interpret_cmdfile(interp,exp_cmdfile);
51
        else if (exp_cmdfilename)
52
                rc = exp_interpret_cmdfilename(interp,exp_cmdfilename);
53
 
54
        /* assert(exp_cmdlinecmds != 0) */
55
 
56
        exp_exit(interp,rc);
57
        /*NOTREACHED*/
58
        return 0;                /* Needed only to prevent compiler warning. */
59
}
60
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.