3 * regexpl - Console Registry Explorer
5 * Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 // ShellCommandConnect.cpp: implementation of the CShellCommandConnect class.
25 //////////////////////////////////////////////////////////////////////
28 #include "ShellCommandConnect.h"
30 #define CONNECT_CMD _T("CONNECT")
31 #define CONNECT_CMD_SHORT_DESC CONNECT_CMD _T(" command is used to connect to remote registry.\n")
33 //////////////////////////////////////////////////////////////////////
34 // Construction/Destruction
35 //////////////////////////////////////////////////////////////////////
37 CShellCommandConnect::CShellCommandConnect(CRegistryTree
& rTree
):m_rTree(rTree
)
41 CShellCommandConnect::~CShellCommandConnect()
45 BOOL
CShellCommandConnect::Match(const TCHAR
*pchCommand
)
47 return _tcsicmp(pchCommand
,CONNECT_CMD
) == 0;
50 int CShellCommandConnect::Execute(CConsole
&rConsole
, CArgumentParser
& rArguments
)
53 const TCHAR
*pchMachine
= NULL
;
56 VERIFY(m_rTree
.ChangeCurrentKey(_T("\\")));
58 while ((pchArg
= rArguments
.GetNextArgument()) != NULL
)
60 if ((_tcsicmp(pchArg
,_T("/?")) == 0)
61 ||(_tcsicmp(pchArg
,_T("-?")) == 0))
65 // else if ((_tcsicmp(pchArg,_T("-a")) == 0)||
66 // (_tcsicmp(pchArg,_T("/a")) == 0))
76 rConsole
.Write(GetHelpString());
78 if (!m_rTree
.SetMachineName(pchMachine
))
80 rConsole
.Write(m_rTree
.GetLastErrorDescription());
81 rConsole
.Write(_T("\n"));
87 const TCHAR
* CShellCommandConnect::GetHelpString()
89 return CONNECT_CMD_SHORT_DESC
90 // _T("Syntax: ") CONNECT_CMD _T(" [Switches] [/?] machine\n\n")
91 _T("Syntax: ") CONNECT_CMD
_T(" /? | MACHINE\n\n")
92 _T(" /? - This help.\n\n")
93 // _T("Switches are:\n")
94 // _T(" -a anonymous login.\n")
95 _T(" MACHINE is name/ip of the remote machine.\n")
97 _T(" ") CONNECT_CMD
_T(" BOB");
100 const TCHAR
* CShellCommandConnect::GetHelpShortDescriptionString()
102 return CONNECT_CMD_SHORT_DESC
;