/** (C) Game Page Network, Inc., Confidential, All Rights Reserved */
// DebugCommand.java
// --paul@gamepage.net, 25jul97

import java.io.*;
import java.util.*;

public class DebugCommand extends Command {
  DebugCommand() {
    super("debug", -1, null, "debug");
    anonymous = true;    
  }
  public void process(StringTokenizer args, Client c) {
    String arg = args.hasMoreTokens() ? args.nextToken() : "";
    int n = Club.atoi(arg);
    if (n > 0) {
      for (int i=0; i<n; i++)
	c.send("# debug "+i);
      return;
    }
    
    c.setDebug(arg.equalsIgnoreCase("on"));
    Runtime r = Runtime.getRuntime();
    c.send("# Runtime memory: "+(r.freeMemory()/1000)+"kb free of "+
	   (r.totalMemory()/1000)+"kb total.");
    c.send("# Club.execCount = "+Club.execCount);
    Reaper.dump();		// Club.log to stdout
    Thread.currentThread().getThreadGroup().list(); // dumps to stdout
    Client.debug(c);		// Club.log to stdout
  }
}

