ReactOS  0.4.15-dev-313-g8fde48b
ShellCommandConnect.cpp
Go to the documentation of this file.
1 /*
2  * regexpl - Console Registry Explorer
3  *
4  * Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 // ShellCommandConnect.cpp: implementation of the CShellCommandConnect class.
23 //
25 
26 #include "ph.h"
27 #include "ShellCommandConnect.h"
28 
29 #define CONNECT_CMD _T("CONNECT")
30 #define CONNECT_CMD_SHORT_DESC CONNECT_CMD _T(" command is used to connect to remote registry.\n")
31 
33 // Construction/Destruction
35 
37 {
38 }
39 
41 {
42 }
43 
45 {
46  return _tcsicmp(pchCommand,CONNECT_CMD) == 0;
47 }
48 
50 {
51  const TCHAR *pchArg;
52  const TCHAR *pchMachine = NULL;
53  BOOL blnHelp = FALSE;
54 
56 
57  while ((pchArg = rArguments.GetNextArgument()) != NULL)
58  {
59  if ((_tcsicmp(pchArg,_T("/?")) == 0)
60  ||(_tcsicmp(pchArg,_T("-?")) == 0))
61  {
62  blnHelp = TRUE;
63  }
64 // else if ((_tcsicmp(pchArg,_T("-a")) == 0)||
65 // (_tcsicmp(pchArg,_T("/a")) == 0))
66 // {
67 // }
68  else
69  {
70  pchMachine = pchArg;
71  }
72  }
73 
74  if (blnHelp)
75  rConsole.Write(GetHelpString());
76 
77  if (!m_rTree.SetMachineName(pchMachine))
78  {
80  rConsole.Write(_T("\n"));
81  }
82 
83  return 0;
84 }
85 
87 {
89 // _T("Syntax: ") CONNECT_CMD _T(" [Switches] [/?] machine\n\n")
90  _T("Syntax: ") CONNECT_CMD _T(" /? | MACHINE\n\n")
91  _T(" /? - This help.\n\n")
92 // _T("Switches are:\n")
93 // _T(" -a anonymous login.\n")
94  _T(" MACHINE is name/ip of the remote machine.\n")
95  _T("Example:\n")
96  _T(" ") CONNECT_CMD _T(" BOB");
97 }
98 
100 {
101  return CONNECT_CMD_SHORT_DESC;
102 }
#define TRUE
Definition: types.h:120
BOOL SetMachineName(LPCTSTR pszMachineName)
#define _tcsicmp
Definition: xmlstorage.h:205
virtual int Execute(CConsole &rConsole, CArgumentParser &rArguments)
virtual const TCHAR * GetHelpString()
BOOL ChangeCurrentKey(const TCHAR *pchRelativePath)
unsigned int BOOL
Definition: ntddk_ex.h:94
TCHAR * GetNextArgument()
#define CONNECT_CMD_SHORT_DESC
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define VERIFY(e)
Definition: ph.h:34
const TCHAR * GetLastErrorDescription()
virtual const TCHAR * GetHelpShortDescriptionString()
BOOL Write(const TCHAR *p, DWORD dwChars=0)
Definition: Console.cpp:90
#define CONNECT_CMD
virtual BOOL Match(const TCHAR *pchCommand)
CShellCommandConnect(CRegistryTree &rTree)