1 package net.sf.tomp.xtcl.command;
2
3 import net.sf.tomp.xtcl.Context;
4
5 import java.io.PrintStream;
6
7 /***
8 * DOCUMENT ME!
9 *
10 * @author tomp
11 */
12 public class Echo extends AbstractCommand {
13 /*** DOCUMENT ME! */
14 protected String echo;
15
16 /***
17 * DOCUMENT ME!
18 *
19 * @param c DOCUMENT ME!
20 */
21 public void setEcho(String c) {
22 echo = c;
23 }
24
25 public int execute(Context c) throws Exception {
26 PrintStream out = c.getOut();
27
28 if (out != null) {
29 out.println(echo);
30 }
31
32 return done(c, 0);
33 }
34
35 /***
36 * DOCUMENT ME!
37 *
38 * @return DOCUMENT ME!
39 */
40 public String toString() {
41 return "ECHO " + echo;
42 }
43 }
44
45 /*
46 * The contents of this file are subject to the Mozilla Public License Version
47 * 1.1 (the "License"); you may not use this file except in compliance with the
48 * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
49 * Software distributed under the License is distributed on an "AS IS" basis,
50 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
51 * the specific language governing rights and limitations under the License. The
52 * Original Code is: all this file. The Initial Developer of the Original Code
53 * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
54 */