Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1998 Intel Corporation
  3. Module Name:
  4. echo.c
  5. Abstract:
  6. Shell app "echo"
  7. Revision History
  8. --*/
  9. #include "shelle.h"
  10. /*///////////////////////////////////////////////////////////////////////
  11. Function Name:
  12. SEnvCmdEcho
  13. Description:
  14. Shell command "echo".
  15. */
  16. EFI_STATUS
  17. SEnvCmdEcho (
  18. IN EFI_HANDLE ImageHandle,
  19. IN EFI_SYSTEM_TABLE *SystemTable
  20. )
  21. {
  22. CHAR16 **Argv;
  23. UINTN Argc;
  24. UINTN Index;
  25. InitializeShellApplication (ImageHandle, SystemTable);
  26. Argv = SI->Argv;
  27. Argc = SI->Argc;
  28. /*
  29. * No args: print status
  30. * One arg, either -on or -off: set console echo flag
  31. * Otherwise: echo all the args. Shell parser will expand any args or vars.
  32. */
  33. if ( Argc == 1 ) {
  34. Print( L"Echo is %s\n", (SEnvBatchGetEcho()?L"on":L"off") );
  35. } else if ( Argc == 2 && StriCmp( Argv[1], L"-on" ) == 0 ) {
  36. SEnvBatchSetEcho( TRUE );
  37. } else if ( Argc == 2 && StriCmp( Argv[1], L"-off" ) == 0 ) {
  38. SEnvBatchSetEcho( FALSE );
  39. } else {
  40. for (Index = 1; Index < Argc; Index += 1) {
  41. Print( L"%s ", Argv[Index] );
  42. }
  43. Print( L"\n" );
  44. }
  45. return EFI_SUCCESS;
  46. }