01: /*
02: * ExitCmd.java
03: *
04: * Copyright (c) 1997 Cornell University.
05: * Copyright (c) 1997 Sun Microsystems, Inc.
06: *
07: * See the file "license.terms" for information on usage and
08: * redistribution of this file, and for a DISCLAIMER OF ALL
09: * WARRANTIES.
10: *
11: * RCS: @(#) $Id: ExitCmd.java,v 1.1.1.1 1998/10/14 21:09:19 cvsadmin Exp $
12: *
13: */
14:
15: package tcl.lang;
16:
17: /**
18: * This class implements the built-in "exit" command in Tcl.
19: */
20: class ExitCmd implements Command {
21:
22: /**
23: * See Tcl user documentation for details.
24: */
25: public void cmdProc(Interp interp, TclObject argv[])
26: throws TclException {
27: int code;
28:
29: if (argv.length > 2) {
30: throw new TclNumArgsException(interp, 1, argv,
31: "?returnCode?");
32: }
33: if (argv.length == 2) {
34: code = TclInteger.get(interp, argv[1]);
35: } else {
36: code = 0;
37: }
38:
39: System.exit(code);
40: }
41: }
|