update for HEAD-2003050101
[reactos.git] / subsys / system / cmd / pause.c
1 /*
2  *  PAUSE.C - pause internal command.
3  *
4  *
5  *  History:
6  *
7  *    16 Jul 1998 (Hans B Pufal)
8  *        started.
9  *
10  *    16 Jul 1998 (John P Price)
11  *        Seperated commands into individual files.
12  *
13  *    27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
14  *        added config.h include
15  *
16  *    18-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
17  *        Unicode ready!
18  */
19
20 #include "config.h"
21
22 #ifdef INCLUDE_CMD_PAUSE
23
24 #include <windows.h>
25 #include <tchar.h>
26 #include <string.h>
27
28 #include "cmd.h"
29 #include "batch.h"
30
31
32 /*
33  * Perform PAUSE command.
34  *
35  * FREEDOS extension : If parameter is specified use that as the pause
36  *   message.
37  *
38  * ?? Extend to include functionality of CHOICE if switch chars
39  *     specified.
40  */
41
42 INT cmd_pause (LPTSTR cmd, LPTSTR param)
43 {
44 #ifdef _DEBUG
45         DebugPrintf ("cmd_pause: \'%s\' : \'%s\'\n", cmd, param);
46 #endif
47
48         if (!_tcsncmp (param, _T("/?"), 2))
49         {
50                 ConOutPuts (_T("Stops the execution of a batch file and shows the following message:\n"
51                                            "\"Press any key to continue...\" or a user defined message.\n\n"
52                                            "PAUSE [message]"));
53                 return 0;
54         }
55
56         if (*param)
57                 ConOutPrintf (param);
58         else
59                 msg_pause ();
60
61         cgetchar ();
62
63         return 0;
64 }
65
66 #endif