2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: FailAt - Set the failure level of a process
9 /**************************************************************************
24 FailAt sets the return code limit of the current shell script. If
25 any command returns with a failure code of this value or higher
26 the script shall abort.
28 Common failure codes are:
34 The normal value for the return code limit is 10.
37 If we have a script with the commands
39 Copy RAM:SomeFile DF0:
42 and the file RAM:SomeFile does not exist, the Copy command will
45 Copy: object not found
46 Copy: returned with error code 20
48 and the script will abort. However if you include the command
52 then the script will complete since the return code from Copy is
53 less than the return code limit.
55 **************************************************************************/
57 #include <exec/types.h>
58 #include <exec/tasks.h>
59 #include <dos/dosextens.h>
60 #include <dos/rdargs.h>
61 #include <proto/exec.h>
62 #include <proto/dos.h>
63 #include <utility/tagitem.h>
65 #include <aros/shcommands.h>
67 AROS_SH1H(FailAt
, 41.1, "Set the return code failure limit of the current script",
68 AROS_SHAH(LONG
*, , RCLIM
,/N
, NULL
, "The new return code limit"))
72 struct CommandLineInterface
*cli
= Cli();
80 /* Write current fail level */
81 if (SHArg(RCLIM
) == NULL
)
83 VPrintf("Fail limit: %ld\n", (IPTR
*)&cli
->cli_FailLevel
);
85 /* Set new fail level */
88 cli
->cli_FailLevel
= *SHArg(RCLIM
);