use m4_normalize on the output strings to remove trailing spaces/tabs and consolidate...
[AROS.git] / workbench / c / shellcommands / Why.c
blobcbc64d4b5e9fb7437b1cb25e992a7674ceafafcb
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Why CLI command
6 Lang: English
7 */
9 /******************************************************************************
12 NAME
14 Why
16 SYNOPSIS
18 LOCATION
22 FUNCTION
24 Print additional information why an operation failed. Ordinarily
25 when a command fails a brief message is printed that typically
26 includes the name of the command that failed but provides few
27 details. Why fills in details related to the failed operation.
29 INPUTS
31 RESULT
33 NOTES
35 EXAMPLE
37 BUGS
39 SEE ALSO
41 INTERNALS
43 HISTORY
45 ******************************************************************************/
48 #include <stdio.h>
49 #include <proto/exec.h>
50 #include <proto/dos.h>
51 #include <dos/dos.h>
52 #include <dos/dosextens.h>
54 #include <aros/shcommands.h>
56 AROS_SH0(Why, 41.3)
58 AROS_SHCOMMAND_INIT
60 struct CommandLineInterface *cli;
61 LONG lasterror;
62 int error = RETURN_OK;
65 if ((cli = Cli()) != NULL)
67 lasterror = cli->cli_Result2;
69 if (cli->cli_ReturnCode == 0 || lasterror == 0)
71 VPrintf("The last command did not set a return-value\n", NULL);
73 else
75 PrintFault(lasterror, "The last command failed, reason");
76 SetIoErr(0);
79 else
81 error = RETURN_FAIL;
84 return error;
86 AROS_SHCOMMAND_EXIT