+}
+
+void Tracer::cmd_trace(const string &args)
+{
+ if(args.empty() || args=="-")
+ {
+ set_output(&IO::cout, false);
+ IO::print("Tracing to stdout\n");
+ }
+ else if(args=="on")
+ {
+ if(!out)
+ throw InvalidState("Output is not set");
+ enabled = true;
+ IO::print("Tracing enabled\n");
+ }
+ else if(args=="off")
+ {
+ enabled = false;
+ IO::print("Tracing disabled\n");
+ }
+ else if(args=="end")
+ {
+ set_output(0, true);
+ IO::print("Tracing terminated\n");
+ }
+ else
+ {
+ set_output(new IO::File(args, IO::M_WRITE), true);
+ IO::print("Tracing to %s\n", args);
+ }