Fixed out-by-one error in previous commit.
[AROS.git] / workbench / c / shellcommands / Fault.c
blobef37c1608413e814ff462413559d51190b9e5dac
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Fault - Display an informative message about an error number.
6 Lang: English
7 */
9 /**************************************************************************
11 NAME
12 Fault
14 FORMAT
15 Fault <error number>
17 SYNOPSIS
18 NUMBERS/N/M
20 LOCATION
23 FUNCTION
24 Fault prints the message corresponding with the error number
25 supplied. Any number of error numbers can be given at once,
26 but they must be separated by spaces.
28 EXAMPLE
30 1.SYS:> Fault 205
31 Fault 205: object not found
33 This tells you that the error code 205 means that a disk
34 object could not be found.
36 **************************************************************************/
38 #include <exec/types.h>
39 #include <dos/dos.h>
40 #include <dos/rdargs.h>
41 #include <proto/exec.h>
42 #include <proto/dos.h>
43 #include <utility/tagitem.h>
45 #include <stdlib.h>
46 #include <stdio.h> /* for sprintf() */
47 #include <string.h>
49 #include <aros/shcommands.h>
51 AROS_SH1H(Fault, 41.1, "Display the meaning of a DOS error code",
52 AROS_SHAH(LONG **, ,NUMBERS,/N/M, NULL, "The error numbers you wish to query"))
54 AROS_SHCOMMAND_INIT
56 LONG **theNum = SHArg(NUMBERS);
58 if (theNum)
60 while( *theNum != NULL )
62 LONG num = **theNum;
63 Printf("Fault %ld", num);
64 PrintFault(num, "");
65 theNum++;
69 SetIoErr(0);
71 return RETURN_OK;
73 AROS_SHCOMMAND_EXIT