diff -r 9976f7b9fe66 -r b09fd81894cb tool/cmd_debug.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool/cmd_debug.cpp Tue Jul 22 14:17:20 2008 +0000 @@ -0,0 +1,48 @@ +/***************************************************************************** + * + * $Id$ + * + ****************************************************************************/ + +#include +#include +using namespace std; + +#include "globals.h" + +/*****************************************************************************/ + +const char *help_debug = + "[OPTIONS]\n" + "\n" + "\n" + "Command-specific options:\n"; + +/****************************************************************************/ + +void command_debug(void) +{ + stringstream str; + int debugLevel; + + if (commandArgs.size() != 1) { + stringstream err; + err << "'debug' takes exactly one argument!"; + throw MasterDeviceException(err.str()); + } + + str << commandArgs[0]; + str >> resetiosflags(ios::basefield) // guess base from prefix + >> debugLevel; + + if (str.fail()) { + stringstream err; + err << "Invalid debug level '" << commandArgs[0] << "'!"; + throw MasterDeviceException(err.str()); + } + + masterDev.open(MasterDevice::ReadWrite); + masterDev.setDebug(debugLevel); +} + +/*****************************************************************************/