01: /*
02: * RenameCmd.java
03: *
04: * Copyright (c) 1999 Mo DeJong.
05: * Copyright (c) 1997 Cornell University.
06: * Copyright (c) 1997 Sun Microsystems, Inc.
07: *
08: * See the file "license.terms" for information on usage and
09: * redistribution of this file, and for a DISCLAIMER OF ALL
10: * WARRANTIES.
11: *
12: * RCS: @(#) $Id: RenameCmd.java,v 1.2 1999/08/03 03:07:54 mo Exp $
13: *
14: */
15:
16: package tcl.lang;
17:
18: /**
19: * This class implements the built-in "rename" command in Tcl.
20: */
21:
22: class RenameCmd implements Command {
23: /**
24: *----------------------------------------------------------------------
25: *
26: * Tcl_RenameObjCmd -> RenameCmd.cmdProc
27: *
28: * This procedure is invoked to process the "rename" Tcl command.
29: * See the user documentation for details on what it does.
30: *
31: * Results:
32: * A standard Tcl object result.
33: *
34: * Side effects:
35: * See the user documentation.
36: *
37: *----------------------------------------------------------------------
38: */
39:
40: public void cmdProc(Interp interp, TclObject[] objv)
41: throws TclException {
42: String oldName, newName;
43:
44: if (objv.length != 3) {
45: throw new TclNumArgsException(interp, 1, objv,
46: "oldName newName");
47: }
48:
49: oldName = objv[1].toString();
50: newName = objv[2].toString();
51:
52: interp.renameCommand(oldName, newName);
53: return;
54: }
55: }
|