void Console::cmdConnect(const QString& args) { QString ret; if (args == "") { ret = "UASGE\nconnect <DeviceID>"; } if (this->isConnected) ret = "already connected"; else { extern MainWindow *mw; this->dev = mw->GetDeviceById(args); if (this->dev == NULL) ret = "unknown device"; else { connect(this, SIGNAL(onCommand(QString)), this->dev, SLOT(onExecuteCommand(QString))); connect(this->dev, SIGNAL(KeepCommandRequest()), this, SLOT(KeepCommandString())); connect(this->dev, SIGNAL(CommandReturn()), this, SLOT(CommandFinished())); connect(this->dev, SIGNAL(ConsoleWrite(QString)) , this, SLOT(ConsoleWriteRequest(QString))); connect(this->dev, SIGNAL(ConsoleWriteHTML(QString)), this, SLOT(ConsoleWriteRequestHTML(QString))); connect(this->dev, SIGNAL(ChangePrompt(QString)), this, SLOT(ChangePrompt(QString))); connect(this, SIGNAL(CommandInterrupted(QString)), this->dev, SLOT(onCommandInterrupt(QString))); connect(this->dev, SIGNAL(DisconnectConsole()), this, SLOT(cmdExit())); connect(this->dev, SIGNAL(destroyed()), this, SLOT(DeviceDeleted())); this->isConnected = true; ret = "connected to " + args; } } ConsoleWriteRequest(ret); CommandFinished(); }
bool Debugger::Cmd_PlayMovie(int argc, const char **argv) { if (argc != 2) { debugPrintf("Format: playmovie <movie-file>\n"); return true; } // play gets postponed until debugger is closed Common::String filename = argv[1]; _playMovieFile = filename; return cmdExit(0, 0); }
void Console::cmdExit() { disconnect(this, SIGNAL(onCommand(QString)), this->dev, SLOT(onExecuteCommand(QString))); disconnect(this->dev, SIGNAL(KeepCommandRequest()), this, SLOT(KeepCommandString())); disconnect(this->dev, SIGNAL(CommandReturn()), this, SLOT(CommandFinished())); disconnect(this->dev, SIGNAL(ConsoleWrite(QString)) , this, SLOT(ConsoleWriteRequest(QString))); disconnect(this->dev, SIGNAL(ConsoleWriteHTML(QString)), this, SLOT(ConsoleWriteRequestHTML(QString))); disconnect(this->dev, SIGNAL(ChangePrompt(QString)), this, SLOT(ChangePrompt(QString))); disconnect(this, SIGNAL(CommandInterrupted(QString)), this->dev, SLOT(onCommandInterrupt(QString))); disconnect(this->dev, SIGNAL(DisconnectConsole()), this, SLOT(cmdExit())); disconnect(this->dev, SIGNAL(destroyed()), this, SLOT(DeviceDeleted())); emit disconnectCommand(this); this->isConnected = false; ConsoleWriteRequest("connection closed with "+this->dev->GetDeviceID()); CommandFinished(); this->dev = NULL; }
int main() { char cmd[256]; char *token; printf ("Testing for T2FS - v 1.0\n"); cmdMan(); while (1) { printf ("T2FS> "); gets(cmd); if( (token = strtok(cmd," \t")) != NULL ) { if (strcmp(token,"exit")==0) { cmdExit(); break; } else if (strcmp(token,"man")==0) cmdMan(); else if (strcmp(token,"who")==0) cmdWho(); else if (strcmp(token,"cp")==0) cmdCp(); else if (strcmp(token,"fscp")==0) cmdFscp(); else if (strcmp(token,"create")==0) cmdCreate(); else if (strcmp(token,"del")==0) cmdDelete(); else if (strcmp(token,"open")==0) cmdOpen(); else if (strcmp(token,"close")==0) cmdClose(); else if (strcmp(token,"read")==0) cmdRead(); else if (strcmp(token,"mkdir")==0) cmdMkdir(); else if (strcmp(token,"md")==0) cmdMkdir(); else if (strcmp(token,"rmdir")==0) cmdRmdir(); else if (strcmp(token,"rm")==0) cmdRmdir(); else if (strcmp(token,"getcwd")==0) cmdGetcwd(); else if (strcmp(token,"chdir")==0) cmdChdir(); else if (strcmp(token,"cd")==0) cmdChdir(); else if (strcmp(token,"ls")==0) cmdLs(); else if (strcmp(token,"dir")==0) cmdLs(); else printf ("???\n"); } } return 0; }