01: /*
02: * CloseCmd.java --
03: *
04: * Copyright (c) 1997 Sun Microsystems, Inc.
05: *
06: * See the file "license.terms" for information on usage and
07: * redistribution of this file, and for a DISCLAIMER OF ALL
08: * WARRANTIES.
09: *
10: * RCS: @(#) $Id: CloseCmd.java,v 1.2 2000/08/01 06:50:48 mo Exp $
11: *
12: */
13:
14: package tcl.lang;
15:
16: import java.util.*;
17: import java.io.*;
18:
19: /**
20: * This class implements the built-in "close" command in Tcl.
21: */
22:
23: class CloseCmd implements Command {
24: /**
25: * This procedure is invoked to process the "close" Tcl command.
26: * See the user documentation for details on what it does.
27: *
28: * @param interp the current interpreter.
29: * @param argv command arguments.
30: */
31:
32: public void cmdProc(Interp interp, TclObject argv[])
33: throws TclException {
34:
35: Channel chan; /* The channel being operated on this method */
36:
37: if (argv.length != 2) {
38: throw new TclNumArgsException(interp, 1, argv, "channelId");
39: }
40:
41: chan = TclIO.getChannel(interp, argv[1].toString());
42: if (chan == null) {
43: throw new TclException(interp,
44: "can not find channel named \""
45: + argv[1].toString() + "\"");
46: }
47:
48: TclIO.unregisterChannel(interp, chan);
49: }
50: }
|