File: tclshrl.c

package info (click to toggle)
tclreadline 1.2.0-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 464 kB
  • ctags: 313
  • sloc: tcl: 5,956; sh: 1,544; ansic: 694; makefile: 203
file content (66 lines) | stat: -rw-r--r-- 1,695 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

 /* ==================================================================

    FILE: "/home/joze/src/tclreadline/tclshrl.c"
    LAST MODIFICATION: "Sat, 25 Mar 2000 20:51:39 +0100 (joze)"
    (C) 1998 - 2000 by Johannes Zellner, <johannes@zellner.org>
    $Id: tclshrl.c,v 1.3 2000/03/25 20:59:12 joze Exp $
    ---

    tclreadline -- gnu readline for tcl
    http://www.zellner.org/tclreadline/
    Copyright (c) 1998 - 2000, Johannes Zellner <johannes@zellner.org>

    This software is copyright under the BSD license.

    ================================================================== */  

#ifdef HAVE_CONFIG_H
#   include "config.h"
#endif

#include <tcl.h>
#include <tclreadline.h>

#if 0
#include <assert.h>
#endif

extern int Tclreadline_Init(Tcl_Interp *interp);
extern int Tclreadline_SafeInit(Tcl_Interp *interp);

int
TclreadlineAppInit(Tcl_Interp* interp)
{
    char file[0xff];
    int status;
#if 0
    assert(Tcl_InitStubs(interp, TCL_VERSION, 0));
#endif
    if (TCL_ERROR == Tcl_Init(interp)) {
	return TCL_ERROR;
    }
    if (TCL_ERROR == Tclreadline_Init(interp)) {
	return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "tclreadline",
	Tclreadline_Init, Tclreadline_SafeInit);
#if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION == 4)
    tcl_RcFileName = "~/.tclshrc";
#else
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
#endif
    sprintf(file, "%s/tclreadlineInit.tcl", TCLRL_LIBRARY);
    if ((status = Tcl_EvalFile(interp, file))) {
	fprintf(stderr, "(TclreadlineAppInit) unable to eval %s\n", file);
	exit (1);
    }
    return TCL_OK;
}

int
main(int argc, char *argv[])
{
    Tcl_Main(argc, argv, TclreadlineAppInit);
    return 0;
}