Beispiel #1
0
void executeCommand(struct Kommando *cmd) {
  int afterRexxScript;
  if(cmd->before) {
    sendautorexx(cmd->before);
  }
  if(cmd->logstr[0]) {
    LogEvent(USAGE_LOG, INFO, "%s %s", getusername(inloggad), cmd->logstr);
  }
  if(cmd->vilkainfo[0]) {
    Servermem->action[nodnr] = GORNGTANNAT;
    Servermem->vilkastr[nodnr] = cmd->vilkainfo;
  }
  // Save 'after' in case the command to execute is to reload the config and
  // cmd is not a valid pointer anymore when DoExecuteCommand() returns.
  afterRexxScript = cmd->after; 
  DoExecuteCommand(cmd);
  if(afterRexxScript) {
    sendautorexx(afterRexxScript);
  }
}
Beispiel #2
0
//---------------------------------------------------------------------
bool __fastcall TConsoleDialog::Execute(const UnicodeString Command,
  const TStrings * Log)
{
  try
  {
    CommandEdit->Items = CustomWinConfiguration->History[L"Commands"];

    if (Log != NULL)
    {
      OutputMemo->Lines->BeginUpdate();
      try
      {
        TStrings * ALog = const_cast<TStrings *>(Log);
        for (int i = 0; i < ALog->Count; i++)
        {
          AddLine(ALog->Strings[i], cotOutput);
        }
      }
      __finally
      {
        OutputMemo->Lines->EndUpdate();
      }
    }

    if (!Command.IsEmpty())
    {
      CommandEdit->Text = Command;
      DoExecuteCommand();
    }
    UpdateControls();
    ShowModal();

    TConsoleWinConfiguration ConsoleWin = CustomWinConfiguration->ConsoleWin;
    if ((FAutoBounds.Width() != Width) ||
        (FAutoBounds.Height() != Height))
    {
      ConsoleWin.WindowSize = StoreFormSize(this);
    }
    CustomWinConfiguration->ConsoleWin = ConsoleWin;
  }