- Print out an error when the stack for a command can't be allocated
[AROS.git] / workbench / c / Reboot.c
blob32dd0110084909895a893329dfbb60638621a6d1
1 /*
2 Copyright 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Reboot CLI command
6 Lang: English
7 */
9 /******************************************************************************
11 NAME
13 Reboot
15 SYNOPSIS
17 COLD/S
19 LOCATION
23 FUNCTION
25 It reboots the machine
27 INPUTS
29 COLD -- tells to perform cold (complete) reboot of the machine.
30 Otherwise only AROS is restarted.
32 NOTES
34 Any programs and data in memory will be lost and all disk
35 activity will cease. Make sure no disk access is being
36 carried out by your computer.
39 SEE ALSO
41 Shutdown
43 ******************************************************************************/
45 #include <dos/dos.h>
46 #include <exec/tasks.h>
47 #include <proto/dos.h>
48 #include <proto/exec.h>
49 #include <proto/graphics.h>
51 int __nocommandline;
53 int main()
55 struct RDArgs *rda;
56 IPTR cold = 0;
58 rda = ReadArgs("COLD/S", &cold, NULL);
60 if (rda == NULL)
62 PrintFault(IoErr(),"Reboot");
63 return RETURN_FAIL;
65 FreeArgs(rda);
67 if (cold)
68 ShutdownA(SD_ACTION_COLDREBOOT);
69 else
70 ColdReboot();
72 /* If we are here, shutdown did not work for some reason */
73 Delay(25);
74 PutStr("This action is not supported\n");
75 return 0;