applayerprotocols/ftpengine/consui/FTPUI.CPP
changeset 0 b16258d2340f
child 49 b91bcc4b38e4
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Author: Philippe Gabriel
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file FTPUI.CPP
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include "FTPUI.H"
       
    24 #include "FTPSESS.H"
       
    25 #include <e32base.h>
       
    26 
       
    27 void CFtpUI::ServerMessage(const TDesC8& aMessage)
       
    28 /**
       
    29 Implementation of the FTPSession Call back Minterface
       
    30 */
       
    31 {
       
    32 // Display Message from server
       
    33 iUBuffer.Copy(aMessage);
       
    34 iConsole->Write(iUBuffer);
       
    35 }
       
    36 
       
    37 void CFtpUI::Complete(void)
       
    38 {
       
    39 switch (iCurCmd)
       
    40 	{
       
    41 	// Connection commands
       
    42 	case EConnectDNS:
       
    43 	case EConnectIP:
       
    44 		iConsole->Write(_L("Connection Completed OK\n"));
       
    45 		break;
       
    46 	case EClose:
       
    47 		iConsole->Write(_L("Connection Closed OK\n"));
       
    48 		break;
       
    49 	case EActive:
       
    50 		break;
       
    51 	case Epasv:
       
    52 		break;
       
    53 	// Xfer cmds
       
    54 	case EPut:
       
    55 	case EGet:
       
    56 	case EBin:
       
    57 	case EAsc:
       
    58 	case ERest:
       
    59 	case EOver:
       
    60 	// File cmds
       
    61 	case EDel:
       
    62 	case ERen:
       
    63 	// Dir cmds
       
    64 	case EMkdir:
       
    65 	case ERmdir:
       
    66 	case ECd:
       
    67 	case EPwd:
       
    68 		break;
       
    69 	case EList:
       
    70 		iUBuffer.Copy(iFileBuffer);
       
    71 		iConsole->Write(iUBuffer);
       
    72 		break;
       
    73 	// Exit
       
    74 	case EQuit:
       
    75 	case ECancel:
       
    76 	default:
       
    77 		break;
       
    78 	}
       
    79 // Reset the console to fetch next command
       
    80 iCmdConsole->Reset();
       
    81 }
       
    82 
       
    83 TText CFtpUI::getProgressChar() 
       
    84 {
       
    85  if(iProgress) 
       
    86  {
       
    87  iProgressIdx=(iProgressIdx+1) & 0x3;
       
    88  }
       
    89  switch(iProgressIdx) 
       
    90  {
       
    91  case 0: return TText('|');
       
    92  case 1: return TText('/');
       
    93  case 2: return TText('-');
       
    94  case 3: return TText('\\');
       
    95  }
       
    96  return TText('O');
       
    97  }
       
    98 
       
    99 void CFtpUI::TransferProgress(TUint aProgress)
       
   100 {
       
   101 iTransferProgress += aProgress;
       
   102 if(aProgress) 
       
   103  iProgress = ETrue;
       
   104 TTime now; 
       
   105 now.HomeTime();
       
   106 TTimeIntervalSeconds elapsedSec;
       
   107 TInt res=now.SecondsFrom(iLastTime,elapsedSec);
       
   108 if(res!=KErrNone || elapsedSec.Int()>=10) 
       
   109  {
       
   110  iConsole->SetPos(0,iConsole->WhereY()-1);
       
   111  iConsole->Printf(_L("\n%c TransferProgress : %u kB        "),getProgressChar(),(TUint)( iTransferProgress>>10));
       
   112  iLastTime.HomeTime();
       
   113  iProgress=EFalse;
       
   114  }
       
   115 }
       
   116 
       
   117 void CFtpUI::Cancel(void)
       
   118 {
       
   119 iConsole->Printf(_L("\n---Cancel Completed---\n"));
       
   120 // Reset the console to fetch next command
       
   121 iCmdConsole->Reset();
       
   122 }
       
   123 
       
   124 void CFtpUI::ConnReset(void)
       
   125 {
       
   126 iConsole->Printf(_L("\n---Conn RESET---\n"));
       
   127 // Reset the console to fetch next command
       
   128 iCmdConsole->Reset();
       
   129 }
       
   130 
       
   131 void CFtpUI::ConnectionError(TOpComp aTConnectionError)
       
   132 {
       
   133 iConsole->Printf(_L("\nConnection ERROR : "));
       
   134 switch(aTConnectionError)
       
   135 	{
       
   136 	case EHostNotExist:	// Connect address invalid
       
   137 		iConsole->Printf(_L("Host does not exist\n"));
       
   138 		break;
       
   139 	case ESocketError:	// Problem with socket operation
       
   140 		iConsole->Printf(_L("Socket error\n"));
       
   141 		break;
       
   142 	case EConnectionFailed:	// Can't connect to FTP port
       
   143 		iConsole->Printf(_L("Connection failed\n"));
       
   144 		break;
       
   145 	case EPasswordNeeded:
       
   146 		iConsole->Printf(_L("Password needed\n"));
       
   147 		break;
       
   148 	case EAccountNeeded:	// i.e. anonymous login disallowed
       
   149 		iConsole->Printf(_L("Account needed\n"));
       
   150 		break;
       
   151 	case ELoginFailed:	// UserName,Password combination invalid
       
   152 		iConsole->Printf(_L("Login failed\n"));
       
   153 		break;
       
   154 	case ENotConnected:	// Not connected to a server
       
   155 		iConsole->Printf(_L("Not connected anywhere\n"));
       
   156 		break;
       
   157 	case EAlreadyConnected:	// Already connected to a server
       
   158 		iConsole->Printf(_L("Already connected\n"));
       
   159 		break;
       
   160 	case ETimedOut:	// Inactive for too long
       
   161 		iConsole->Printf(_L("Timed Out\n"));
       
   162 		break;
       
   163 	default:
       
   164 		iConsole->Printf(_L("Internal Error: 0x56af087bb:0234\nThis is very very bad news\n"));
       
   165 		break;
       
   166 	}
       
   167 // Reset the console to fetch next command
       
   168 iCmdConsole->Reset();
       
   169 }
       
   170 
       
   171 void CFtpUI::OperationNotSupported(void)
       
   172 {}
       
   173 
       
   174 void CFtpUI::LocalFileSystemError(TOpComp /*aTLocalFileSystemError*/)
       
   175 {
       
   176 iConsole->Printf(_L("\nLocalFileSystemError\n"));
       
   177 // Reset the console to fetch next command
       
   178 iCmdConsole->Reset();
       
   179 }
       
   180 
       
   181 void CFtpUI::RemoteFileSystemError(TOpComp /*aTRemoteFileSystemError*/)
       
   182 {
       
   183 //CActiveScheduler::Stop();
       
   184 iConsole->Printf(_L("\nRemoteFileSystemError\n"));
       
   185 // Reset the console to fetch next command
       
   186 iCmdConsole->Reset();
       
   187 }
       
   188 
       
   189 void CFtpUI::EUnknownError(void)
       
   190 {
       
   191 iConsole->Printf(_L("\nUnknownError\n"));
       
   192 // Reset the console to fetch next command
       
   193 iCmdConsole->Reset();
       
   194 }
       
   195 
       
   196 void CFtpUI::MoreData(void)	
       
   197 {
       
   198 	iUBuffer.Copy(iFileBuffer);
       
   199 	iConsole->Write(iUBuffer);
       
   200 	
       
   201 	iFileBuffer.FillZ(iFileBuffer.MaxLength());
       
   202 	iFileBuffer.Zero();
       
   203     iFTPSession->ListDirectory(_L8(""),iFileBuffer);
       
   204 	return;
       
   205 }
       
   206 
       
   207 void CFtpUI::Escape(void)
       
   208 /**
       
   209 Implement a console callback Minterface notifier
       
   210 */
       
   211 {
       
   212 	iCurCmd = ECancel;
       
   213 	iConsole->Write(_L("\nCaNceling lAsT coMmaNd\n"));
       
   214 	iFTPSession->Cancel();
       
   215 }
       
   216 void CFtpUI::CmdReady(void)
       
   217 {
       
   218 
       
   219 /*__FTPDebugConsole->Write(_L("\nNotif recved\n"));
       
   220 __FTPDebugConsole->Write(_L("Buffer :"));
       
   221 __FTPDebugConsole->Write(myCmdConsole->FetchCmd());
       
   222 __FTPDebugConsole->Write(_L("\n"));*/
       
   223 switch(Parse(iCmdConsole->FetchCmd()))
       
   224 	{
       
   225 	case CFtpUI::EError:
       
   226 		// Just reset the thing
       
   227 		iCmdConsole->Reset();
       
   228 		break;
       
   229 	case CFtpUI::EContinue:
       
   230 		// Loop again to fetch more params
       
   231 		iCmdConsole->Reset();
       
   232 		break;
       
   233 	case CFtpUI::ESuccess:
       
   234 		// Execute the command
       
   235 		Execute();	
       
   236 		break;
       
   237 	}
       
   238 }
       
   239 
       
   240 CFtpUI::CFtpUI(void)
       
   241 {
       
   242 iCurCmd = EInvalid ;
       
   243 iConnMode = CFTPSession::EActive;
       
   244 iOpenMode = CFTPSession::EOverwrite;
       
   245 iType = CFTPSession::EBinary;
       
   246 iState = EInputCmd;
       
   247 iFs.Connect(KFileServerDefaultMessageSlots);
       
   248 }
       
   249 
       
   250 CFtpUI::~CFtpUI(void)
       
   251 {
       
   252 iFs.Close();
       
   253 }
       
   254 
       
   255 void CFtpUI::SetConsole(CConsoleBase* aConsole)
       
   256 	{iConsole = aConsole;}
       
   257 
       
   258 void CFtpUI::SetCmdConsole(CmdConsole* aCmdConsole)
       
   259 	{iCmdConsole = aCmdConsole;}
       
   260 
       
   261 void CFtpUI::SetFTPSession(CFTPSession* aFTPSession)
       
   262 	{iFTPSession = aFTPSession;}
       
   263 
       
   264 CFtpUI::TParseResult CFtpUI::Parse(TDesC& iCommand)
       
   265 /**
       
   266 Parse a command - Fill in iCmdBuffer - iParamBuffer1 - iParamBuffer2
       
   267 */
       
   268 	{
       
   269 	TLex input(iCommand);
       
   270 	// Extract Tokens
       
   271 	switch(iState)
       
   272 		{
       
   273 		case EInputLogin:
       
   274 			iParamBuffer2.FillZ(iParamBuffer2.MaxLength());
       
   275 			iParamBuffer2.Copy(input.NextToken());
       
   276 			iState = EInputPass;
       
   277 			iConsole->Write(_L("Password: "));
       
   278 			return EContinue;
       
   279 		case EInputPass:
       
   280 			iParamBuffer3.FillZ(iParamBuffer2.MaxLength());
       
   281 			iParamBuffer3.Copy(input.NextToken());
       
   282 			iState = EInputCmd;
       
   283 			return ESuccess;
       
   284 		default:
       
   285 			break;
       
   286 		}
       
   287 	// Default case, Fetch command + params
       
   288 	// Reset buffers
       
   289 	iCmdBuffer.FillZ(iCmdBuffer.MaxLength());
       
   290 	iParamBuffer1.FillZ(iParamBuffer1.MaxLength());
       
   291 	iParamBuffer2.FillZ(iParamBuffer2.MaxLength());
       
   292 	iCmdBuffer.Copy(input.NextToken());
       
   293 	iCmdBuffer.LowerCase();
       
   294 	iParamBuffer1.Copy(input.NextToken());
       
   295 	iParamBuffer2.Copy(input.NextToken());
       
   296 	// Drop a trace
       
   297 /*	FTPPROTDEBUG(0xffff,_L("\nCmd:"));
       
   298 	FTPPROTDEBUG(0xffff,iCmdBuffer);
       
   299 	FTPPROTDEBUG(0xffff,_L("\n"));
       
   300 	FTPPROTDEBUG(0xffff,_L("Param1:"));
       
   301 	FTPPROTDEBUG(0xffff,iParamBuffer1);
       
   302 	FTPPROTDEBUG(0xffff,_L("\n"));
       
   303 	FTPPROTDEBUG(0xffff,_L("Param2:"));
       
   304 	FTPPROTDEBUG(0xffff,iParamBuffer2);
       
   305 	FTPPROTDEBUG(0xffff,_L("\n"));*/
       
   306 	// Fetch a command
       
   307 	// Very very crude parser - programmers in a hurry Limited
       
   308 	
       
   309 		if (KErrNotFound != iCmdBuffer.Match(_L("connect")))
       
   310 			{
       
   311 			iCurCmd = EConnectDNS;
       
   312 			iState = EInputLogin;
       
   313 			iConsole->Write(_L("Login: "));
       
   314 			return EContinue;
       
   315 			}
       
   316 		else if (KErrNotFound != iCmdBuffer.Match(_L("close")))
       
   317 			iCurCmd = EClose;
       
   318 		else if (KErrNotFound != iCmdBuffer.Match(_L("active")))
       
   319 			iCurCmd = EActive;
       
   320 		else if (KErrNotFound != iCmdBuffer.Match(_L("pasv")))
       
   321 			iCurCmd = Epasv;
       
   322 		else if (KErrNotFound != iCmdBuffer.Match(_L("put")))
       
   323 			iCurCmd = EPut;
       
   324 		else if (KErrNotFound != iCmdBuffer.Match(_L("get")))
       
   325 			iCurCmd = EGet;
       
   326 		else if (KErrNotFound != iCmdBuffer.Match(_L("bin")))
       
   327 			iCurCmd = EBin;
       
   328 		else if (KErrNotFound != iCmdBuffer.Match(_L("asc")))
       
   329 			iCurCmd = EAsc;
       
   330 		else if (KErrNotFound != iCmdBuffer.Match(_L("rest")))
       
   331 			iCurCmd = ERest;
       
   332 		else if (KErrNotFound != iCmdBuffer.Match(_L("over")))
       
   333 			iCurCmd = EOver;
       
   334 		else if (KErrNotFound != iCmdBuffer.Match(_L("expand")))
       
   335 			iCurCmd = EExpand;
       
   336 		else if (KErrNotFound != iCmdBuffer.Match(_L("del")))
       
   337 			iCurCmd = EDel;
       
   338 		else if (KErrNotFound != iCmdBuffer.Match(_L("ren")))
       
   339 			iCurCmd = ERen;
       
   340 		else if (KErrNotFound != iCmdBuffer.Match(_L("mkdir")))
       
   341 			iCurCmd = EMkdir;
       
   342 		else if (KErrNotFound != iCmdBuffer.Match(_L("rmdir")))
       
   343 			iCurCmd = ERmdir;
       
   344 		else if (KErrNotFound != iCmdBuffer.Match(_L("cd")))
       
   345 			iCurCmd = ECd;
       
   346 		else if (KErrNotFound != iCmdBuffer.Match(_L("pwd")))
       
   347 			iCurCmd = EPwd;
       
   348 		else if (KErrNotFound != iCmdBuffer.Match(_L("lcd")))
       
   349 			iCurCmd = ELcd;
       
   350 		else if (KErrNotFound != iCmdBuffer.Match(_L("list")))
       
   351 			iCurCmd = EList;
       
   352 		else if (KErrNotFound != iCmdBuffer.Match(_L("ls")))
       
   353 			iCurCmd = EList;
       
   354 		else if (KErrNotFound != iCmdBuffer.Match(_L("quit")))
       
   355 			iCurCmd = EQuit;
       
   356 		else if (KErrNotFound != iCmdBuffer.Match(_L("ver")))
       
   357 			iCurCmd = EVer;
       
   358 		else if (
       
   359 			(KErrNotFound != iCmdBuffer.Match(_L("help")))
       
   360 			||(KErrNotFound != iCmdBuffer.Match(_L("?"))))
       
   361 			iCurCmd = EHelp;
       
   362 		else if (iCmdBuffer.Length() == 0)
       
   363 			{
       
   364 			iCurCmd = EInvalid;
       
   365 			return EContinue;
       
   366 			}
       
   367 		else
       
   368 			{
       
   369 			iConsole->Write(_L("Enter a valid command please\n"));
       
   370 			iCurCmd = EInvalid;
       
   371 			return EError;
       
   372 			}
       
   373 	return ESuccess;
       
   374 	}
       
   375 
       
   376 TBool CFtpUI::Execute(void)
       
   377 /**
       
   378 Execute a previously parsed command
       
   379 */
       
   380 	{
       
   381 	TUint	tempValue;
       
   382 	iUParam.Copy(iParamBuffer1);
       
   383 	TLex input(iUParam); // Needed to convert rest parameter
       
   384 	// Reset server message
       
   385 	switch (iCurCmd)
       
   386 		{
       
   387 		
       
   388 		case EInvalid:
       
   389 			iConsole->Write(_L("Enter a valid command first please\n"));
       
   390 			return EFalse;
       
   391 		// Connection commands
       
   392 		case EConnectDNS:
       
   393 			iFTPSession->Connect(iUParam,iParamBuffer2,iParamBuffer3,iConnMode);
       
   394 			break;
       
   395 		case EConnectIP:
       
   396 		case EClose:
       
   397 			iFTPSession->Close();
       
   398 			break;
       
   399 		case EActive:
       
   400 			iConnMode = CFTPSession::EActive;
       
   401 			iConsole->Write(_L("Now connecting in active mode -Dude!\n"));
       
   402 			// Synchronous cmd Get next cmd
       
   403 			iCmdConsole->Reset();
       
   404 			break;
       
   405 		case Epasv:
       
   406 			iConnMode = CFTPSession::Epassive;
       
   407 			iConsole->Write(_L("Now connecting in passive mode -Dude!\n"));
       
   408 			// Synchronous cmd Get next cmd
       
   409 			iCmdConsole->Reset();
       
   410 			break;
       
   411 		// Xfer cmds
       
   412 		case EPut:
       
   413 			iTransferProgress = 0;
       
   414 			iProgress=EFalse;
       
   415             iProgressIdx=0;
       
   416 			iFTPSession->Store(iUParam,
       
   417 							iParamBuffer1,
       
   418 							FALSE,
       
   419 							iType,
       
   420 							CFTPSession::EStream);
       
   421 							iLastTime.HomeTime();          
       
   422 			break;
       
   423 		case EGet:
       
   424 			iTransferProgress = 0;
       
   425 			iLastTime.HomeTime();
       
   426            iProgress=EFalse;
       
   427            iProgressIdx=0;
       
   428 			iFTPSession->Retrieve(iParamBuffer1,
       
   429 							iUParam,
       
   430 							iOpenMode,
       
   431 							iType,
       
   432 							CFTPSession::EStream);
       
   433 
       
   434 			break;
       
   435 		case EBin:
       
   436 			iType = CFTPSession::EBinary;
       
   437 			iConsole->Write(_L("Representation type is now binary\n"));
       
   438 			// Synchronous cmd Get next cmd
       
   439 			iCmdConsole->Reset();
       
   440 			break;
       
   441 		case EAsc:
       
   442 			iType = CFTPSession::EASCII;
       
   443 			iConsole->Write(_L("Representation type is now ASCII\n"));
       
   444 			// Synchronous cmd Get next cmd
       
   445 			iCmdConsole->Reset();
       
   446 			break;
       
   447 		case EVer:
       
   448 			iConsole->Printf(_L("Version is:%x\n"),iFTPSession->GetVersion());
       
   449 			// Synchronous cmd Get next cmd
       
   450 			iCmdConsole->Reset();
       
   451 			break;
       
   452 		case ERest:
       
   453 			input.Val(tempValue,EDecimal);
       
   454 			iConsole->Write(_L("Restarting next file transfer at: "));
       
   455 			iConsole->Printf(_L("%u\n"),tempValue);
       
   456 			iFTPSession->Restart(tempValue);
       
   457 			// Synchronous cmd Get next cmd
       
   458 			iCmdConsole->Reset();
       
   459 			break;
       
   460 		case EExpand:
       
   461 			iConsole->Write(_L("Now openning local files in Expand mode\n"));
       
   462 			iOpenMode = CFTPSession::EExpand;
       
   463 			// Synchronous cmd Get next cmd
       
   464 			iCmdConsole->Reset();
       
   465 			break;
       
   466 		case EOver:
       
   467 			if(iOpenMode == CFTPSession::EOverwrite)
       
   468 				{
       
   469 				iConsole->Write(_L("Now openning local files in Non Overwriting mode\n"));
       
   470 				iOpenMode = CFTPSession::ENoOverwrite;
       
   471 				}
       
   472 			else
       
   473 				{
       
   474 				iConsole->Write(_L("Now openning local files in Overwriting mode\n"));
       
   475 				iOpenMode = CFTPSession::EOverwrite;
       
   476 				}
       
   477 			// Synchronous cmd Get next cmd
       
   478 			iCmdConsole->Reset();
       
   479 			break;
       
   480 		// Local Filesystem cmds
       
   481 		case ELcd:
       
   482 			{/* PG 13/08/1999 This code needs beefed up to implement a clever parser
       
   483 			//Fetch the current session path
       
   484 			iFs.SessionPath(iDirPath);
       
   485 			//Unicodify
       
   486 			iUParam.Copy(iParamBuffer1);
       
   487 			p.Set(iUParam,NULL,&iDirPath);
       
   488 			
       
   489 			iConsole->Printf(_L("current session path:>%S<\n"),&iDirPath);
       
   490 			iConsole->Printf(_L("Parse.FullName:>%S<\n"),&p.FullName());
       
   491 			iConsole->Printf(_L("Parse.DriveAndPath:>%S<\n"),&p.DriveAndPath());
       
   492 			switch(iUParam.Length())
       
   493 			{
       
   494 				case 0:
       
   495 				//if no argument is given to lcd
       
   496 				// just print the current default path
       
   497 					iConsole->Printf(_L("local directory is: %S\n"),&p.FullName());
       
   498 					break;
       
   499 				default:
       
   500 					//Check if root 
       
   501 					if (p.IsRoot())
       
   502 						{}
       
   503 					else
       
   504 						{
       
   505 						// Check this path
       
   506 						if (KErrNone != iFs.Entry(p.FullName(),anEntry))
       
   507 							{
       
   508 							iConsole->Printf(_L("%S directory not found\n"),&p.FullName());
       
   509 							break;
       
   510 							}
       
   511 						if (!anEntry.IsDir())
       
   512 							{
       
   513 							iConsole->Printf(_L("%S is not a directory\n"),&p.FullName());
       
   514 							break;
       
   515 							}
       
   516 						if (KErrNone != iFs.SetSessionPath(p.FullName()))
       
   517 							{
       
   518 							iConsole->Printf(_L("could not set session directory to %S to \n"),&p.FullName());
       
   519 							break;
       
   520 							}
       
   521 						}
       
   522 				iConsole->Printf(_L("Local directory now: %S"),&p.FullName());
       
   523 				}
       
   524 			*/
       
   525 			// Synchronous cmd Get next cmd
       
   526 			iCmdConsole->Reset();
       
   527 			break;
       
   528 			}
       
   529 		// Remote Filesystem cmds
       
   530 		case EDel:
       
   531 			iFTPSession->DeleteFile(iParamBuffer1);
       
   532 			break;
       
   533 		case ERen:
       
   534 			iFTPSession->RenameFile(iParamBuffer1,iParamBuffer2);
       
   535 			break;
       
   536 		// Remote Dir cmds
       
   537 		case EMkdir:
       
   538 			iFTPSession->CreateDirectory(iParamBuffer1);
       
   539 			break;
       
   540 		case ERmdir:
       
   541 			iFTPSession->DeleteDirectory(iParamBuffer1);
       
   542 			break;
       
   543 		case ECd:
       
   544 			iFTPSession->ChangeDirectory(iParamBuffer1);
       
   545 			break;
       
   546 		case EPwd:
       
   547 			iFTPSession->GetCurrentDirectory();
       
   548 			break;
       
   549 		case EList:
       
   550 			iFileBuffer.FillZ(iFileBuffer.MaxLength());
       
   551 			iFileBuffer.Zero();
       
   552 			iFTPSession->ListDirectory(_L8("."),
       
   553 									iFileBuffer);
       
   554 			break;
       
   555 		// Help
       
   556 		case EHelp:
       
   557 			Help();
       
   558 			// Synchronous cmd Get next cmd
       
   559 			iCmdConsole->Reset();
       
   560 			break;
       
   561 		// Exit
       
   562 		case EQuit:
       
   563 			CActiveScheduler::Stop();
       
   564 		default:
       
   565 			break;
       
   566 		}
       
   567 	return ETrue;
       
   568 	}
       
   569 
       
   570 void CFtpUI::Help(void)
       
   571 	{
       
   572 	iConsole->Write(_L("Enter an FTP Command - commands are:\n"));
       
   573 	iConsole->Write(_L("active	: Connect in active mode   - pasv	: Connection in passive mode\n"));
       
   574 	iConsole->Write(_L("connect <hostname|IP address>      - close  : Close connection\n"));
       
   575 	iConsole->Write(_L("cd <dirName>    : Change directory - pwd 	: Print current directory\n"));
       
   576 	iConsole->Write(_L("mkdir <dirName> : Create directory - rmdir <dirName> : Remove directory\n"));
       
   577 	iConsole->Write(_L("list  [dirName] : List directory\n"));
       
   578 	iConsole->Write(_L("del   <filename>: Delete file\n"));
       
   579 	iConsole->Write(_L("ren   <Oldname> <NewName>	: Rename file\n"));
       
   580 	iConsole->Write(_L("bin   : Xfer file in binary mode - asc : Xfer file in Ascii mode\n"));
       
   581 	iConsole->Write(_L("over  : Toggle overwriting of existing Xfered file\n"));
       
   582 	iConsole->Write(_L("expand: Expand existing Xfered file\n"));
       
   583 	iConsole->Write(_L("rest <offset>  : Restart next file Xfer at offset\n"));
       
   584 	iConsole->Write(_L("put <Filename> : Store a file onto a server\n"));
       
   585 	iConsole->Write(_L("get <filename> : Get a file from server\n"));
       
   586 	iConsole->Write(_L("ver : returns the dlls version numbers\n"));
       
   587 	iConsole->Write(_L("Hit the Escape key to cancel the current operation\n"));
       
   588 	}
       
   589 
       
   590