core/src/commands.cpp
changeset 58 377ac716dabb
parent 57 683f4b1f08ce
child 59 c9dfb364c2d1
equal deleted inserted replaced
57:683f4b1f08ce 58:377ac716dabb
    81 	else
    81 	else
    82 		{
    82 		{
    83 		RArray<TPtrC> commands;
    83 		RArray<TPtrC> commands;
    84 		CleanupClosePushL(commands);
    84 		CleanupClosePushL(commands);
    85 		gShell->CommandFactory().ListCommandsL(commands);
    85 		gShell->CommandFactory().ListCommandsL(commands);
    86 		iFormatter = CTextFormatter::NewL(Stdout());
    86 		if (!Stdout().AttachedToConsole())
    87 		iFormatter->ColumnizeL(0, 2, commands.Array());
    87 			{
       
    88 			// Print them one per line (like how ls does it when not attached to a console)
       
    89 			for (TInt i = 0; i < commands.Count(); i++)
       
    90 				{
       
    91 				// The async writing is a legacy from when help was a local command. We don't need to observe it now.
       
    92 				Printf(_L("%S\r\n"), &commands[i]);
       
    93 				}
       
    94 			Complete();
       
    95 			}
       
    96 		else
       
    97 			{
       
    98 			iFormatter = CTextFormatter::NewL(Stdout());
       
    99 			iFormatter->ColumnizeL(0, 2, commands.Array());
       
   100 			Stdout().Write(iFormatter->Descriptor(), iStatus);
       
   101 			SetActive();
       
   102 			}
    88 		CleanupStack::PopAndDestroy(&commands);
   103 		CleanupStack::PopAndDestroy(&commands);
    89 		Stdout().Write(iFormatter->Descriptor(), iStatus);
       
    90 		SetActive();
       
    91 		}
   104 		}
    92 	}
   105 	}
    93 
   106 
    94 void CCmdHelp::OptionsL(RCommandOptionList& aOptions)
   107 void CCmdHelp::OptionsL(RCommandOptionList& aOptions)
    95 	{
   108 	{
  3620 
  3633 
  3621 	process.Resume();
  3634 	process.Resume();
  3622 
  3635 
  3623 	if (iTimeout)
  3636 	if (iTimeout)
  3624 		{
  3637 		{
  3625 		timer.After(timerStat, iTimeout * 1000 * 1000);
       
  3626 		User::WaitForRequest(waitStatus, timerStat);
  3638 		User::WaitForRequest(waitStatus, timerStat);
  3627 		if (iMeasure) endTime = User::NTickCount();
  3639 		if (iMeasure) endTime = User::NTickCount();
  3628 
  3640 
  3629 		if (waitStatus == KRequestPending)
  3641 		if (waitStatus == KRequestPending)
  3630 			{
  3642 			{