Fixed out-by-one error in previous commit.
[AROS.git] / workbench / c / shellcommands / Quit.c
blob3fb2da1b37d7cd4bd891ae9a21b2be32e27756eb
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /******************************************************************************
11 NAME
13 Quit
15 SYNOPSIS
17 RC/N
19 LOCATION
23 FUNCTION
25 INPUTS
27 RC -- the return code
29 RESULT
31 NOTES
33 EXAMPLE
35 BUGS
37 SEE ALSO
39 INTERNALS
41 HISTORY
43 21.01.2000 SDuvan implemented
45 ******************************************************************************/
47 #include <proto/dos.h>
48 #include <dos/dos.h>
49 #include <dos/dosextens.h>
50 #include <dos/rdargs.h>
51 #include "dos_commanderrors.h"
53 #include <aros/shcommands.h>
55 AROS_SH1(Quit, 41.1,
56 AROS_SHA(LONG *, ,RC,/N,NULL))
58 AROS_SHCOMMAND_INIT
60 struct CommandLineInterface *cli = Cli();
61 int retval = RETURN_OK;
64 if(cli && !cli->cli_Interactive)
66 struct FileHandle *fh = BADDR(cli->cli_CurrentInput);
68 fh->fh_Pos = fh->fh_End + 1; /* Simulate an EOF */
70 if(SHArg(RC) != NULL)
71 retval = (int)*SHArg(RC);
74 else
76 PrintFault(ERROR_SCRIPT_ONLY, "Quit");
77 retval = RETURN_FAIL;
80 return retval;
82 AROS_SHCOMMAND_EXIT