f4c01bba15a0d84028cd136ac4e56c9dde2889d8
[reactos.git] / reactos / apps / utils / 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 #define WIN32_LEAN_AND_MEAN
21
22 #include "config.h"
23
24 #ifdef INCLUDE_CMD_PAUSE
25
26 #include <windows.h>
27 #include <tchar.h>
28 #include <string.h>
29
30 #include "cmd.h"
31 #include "batch.h"
32
33
34 /*
35 * Perform PAUSE command.
36 *
37 * FREEDOS extension : If parameter is specified use that as the pause
38 * message.
39 *
40 * ?? Extend to include functionality of CHOICE if switch chars
41 * specified.
42 */
43
44 INT cmd_pause (LPTSTR cmd, LPTSTR param)
45 {
46 #ifdef _DEBUG
47 DebugPrintf ("cmd_pause: \'%s\' : \'%s\'\n", cmd, param);
48 #endif
49
50 if (!_tcsncmp (param, _T("/?"), 2))
51 {
52 ConOutPuts (_T("Stops the execution of a batch file and shows the following message:\n"
53 "\"Press any key to continue...\" or a user defined message.\n\n"
54 "PAUSE [message]"));
55 return 0;
56 }
57
58 if (*param)
59 ConOutPrintf (param);
60 else
61 msg_pause ();
62
63 cgetchar ();
64
65 return 0;
66 }
67
68 #endif