I know I'm doing something wrong. I just need a small console app that logs in to a Linux/Unix box, via SSH, and sends a command, etc., based on the command-line arguments.
I'm sure the initialization is wrong somehow (all the code I have so far is at the end of this):
TScRegStorage* ScRegStorage1 = new TScRegStorage(NULL);
TScSSHClient* ScSSHClient1 = new TScSSHClient(NULL);
TScSSHShell *ScSSHShell1 = new TScSSHShell(NULL);
This is how I'd initialize it in a VCL Form app :
ScSSHClient1->KeyStorage = ScRegStorage1;
ScSSHClient1->HostName = "mtolx195.dc.mars";
ScSSHClient1->User = "oracle";
ScSSHClient1->Password = "dudley";
ScSSHShell1->Client = ScSSHClient1;
ScSSHShell1->Connected = true;
How do I accomplish the same thing in a console app ?
Thanks, for any help !
-----------------------------------------------------------------------------------
#include
#include
#pragma hdrstop
#include "ScBridge.hpp"
#include "ScSSHChannel.hpp"
#include "ScSSHClient.hpp"
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
AnsiString command_str,
server_receipt_str,
param_str_i;
int param_cnt, i;
TReplaceFlags rf;
TScRegStorage* ScRegStorage1 = new TScRegStorage(NULL);
TScSSHClient* ScSSHClient1 = new TScSSHClient(NULL);
TScSSHShell *ScSSHShell1 = new TScSSHShell(NULL);
//ScRegStorage1 = new TScRegStorage;
//new(TScRegStorage *);
//New(ScSSHClient1);
//New(ScSSHShell1);
ScSSHClient1->KeyStorage = ScRegStorage1;
ScSSHClient1->HostName = "mtolx195.dc.mars";
ScSSHClient1->User = "oracle";
ScSSHClient1->Password = "dudley";
ScSSHShell1->Client = ScSSHClient1;
ScSSHShell1->Connected = true;
rf = rf ExecuteCommand(command_str);
fputs(command_str.c_str(), stdout);
ScSSHShell1->Connected = false;
ScSSHClient1->Connected = false;