grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / c / Shell / cliEcho.c
blobca78ee94f6dd321a72e419f0c335f806ec492798
1 /*
2 Copyright (C) 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/dos.h>
7 #include "Shell.h"
9 void cliEcho(ShellState *ss, CONST_STRPTR args)
11 struct LocalVar *lv;
12 BPTR echoOut;
14 /* AmigaDOS's shell is content also with echo being set to anything
15 that begins with "on" in order to trigger commands echoing on,
16 it doesn't really have to be set to just "on". */
17 if ((lv = FindVar("echo", LV_VAR)) == NULL)
18 return;
20 switch (lv->lv_Value[0])
22 case 'o':
23 case 'O':
24 switch (lv->lv_Value[1])
26 case 'n':
27 case 'N':
28 break;
29 default:
30 return;
32 break;
33 default:
34 return;
37 /* Ok, commands echoing is on. */
38 /* If a redirection is present, echoing isn't expected to go to
39 it. If a script is running, building commandLine allows us
40 to show what the command line looks like after arguments
41 substitution. */
42 echoOut = ss->newOut ? ss->oldOut : Output();
44 FPuts(echoOut, ss->command + 2);
46 if (args)
48 FPutC(echoOut, ' ');
49 FPuts(echoOut, args);
52 FPutC(echoOut, '\n');