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.

97 lines
2.2 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 "shell.h"
  10. /*
  11. *
  12. */
  13. EFI_STATUS
  14. InitializeEcho (
  15. IN EFI_HANDLE ImageHandle,
  16. IN EFI_SYSTEM_TABLE *SystemTable
  17. );
  18. /*///////////////////////////////////////////////////////////////////////
  19. Function Name:
  20. InitializeEcho
  21. Description:
  22. Shell command "echo".
  23. */
  24. EFI_DRIVER_ENTRY_POINT(InitializeEcho)
  25. EFI_STATUS
  26. InitializeEcho (
  27. IN EFI_HANDLE ImageHandle,
  28. IN EFI_SYSTEM_TABLE *SystemTable
  29. )
  30. {
  31. CHAR16 **Argv;
  32. UINTN Argc;
  33. UINTN Index;
  34. /*
  35. * Check to see if the app is to install as a "internal command"
  36. * to the shell
  37. */
  38. InstallInternalShellCommand (
  39. ImageHandle, SystemTable, InitializeEcho,
  40. L"echo", /* command */
  41. L"echo [[-on | -off] | [text]", /* command syntax */
  42. L"Echo text to stdout or toggle script echo", /* 1 line descriptor */
  43. NULL /* command help page */
  44. );
  45. /*
  46. * We are no being installed as an internal command driver, initialize
  47. * as an nshell app and run
  48. */
  49. InitializeShellApplication (ImageHandle, SystemTable);
  50. Argv = SI->Argv;
  51. Argc = SI->Argc;
  52. /*
  53. * No args: print status
  54. * One arg, either -on or -off: set console echo flag
  55. * Otherwise: echo all the args. Shell parser will expand any args or vars.
  56. */
  57. if ( Argc == 1 ) {
  58. Print( L"Echo with no args not supported yet\n" );
  59. } else if ( Argc == 2 && StriCmp( Argv[1], L"-on" ) == 0 ) {
  60. Print( L"echo -on not supported yet\n" );
  61. } else if ( Argc == 2 && StriCmp( Argv[1], L"-off" ) == 0 ) {
  62. Print( L"echo -off not supported yet\n" );
  63. } else {
  64. for (Index = 1; Index < Argc; Index += 1) {
  65. Print( L"%s ", Argv[Index] );
  66. }
  67. Print( L"\n" );
  68. }
  69. return EFI_SUCCESS;
  70. }