grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / c / shellcommands / EndCLI.c
bloba82d9064c830517f1eeb6df20c88d81f7931aeef
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: EndCLI CLI command
6 Lang: English
7 */
9 /******************************************************************************
12 NAME
14 EndCLI
16 SYNOPSIS
18 LOCATION
22 FUNCTION
24 Exits a Shell/CLI.
26 INPUTS
28 RESULT
30 NOTES
32 EXAMPLE
34 BUGS
36 SEE ALSO
38 INTERNALS
40 HISTORY
42 ******************************************************************************/
45 #include <proto/dos.h>
46 #include <dos/dos.h>
47 #include <dos/dosextens.h>
49 #include <aros/shcommands.h>
51 AROS_SH0(EndCLI, 41.3)
53 AROS_SHCOMMAND_INIT
55 struct CommandLineInterface *cli = Cli();
58 if (cli)
60 struct FileHandle *fhin = BADDR(cli->cli_StandardInput);
62 if (cli->cli_CurrentInput && cli->cli_CurrentInput != cli->cli_StandardInput) {
63 Close(cli->cli_CurrentInput);
64 cli->cli_CurrentInput = cli->cli_StandardInput;
67 cli->cli_Background = DOSTRUE;
69 fhin->fh_End = 0; /* Simulate an EOF */
71 if (cli->cli_Interactive)
72 Printf("Task %ld ending\n", ((struct Process *)FindTask(NULL))->pr_TaskNum);
75 return RETURN_OK;
77 AROS_SHCOMMAND_EXIT