update for HEAD-2003091401
[reactos.git] / subsys / system / cmd / delay.c
1 /*
2  * DELAY.C - internal command.
3  *
4  * clone from 4nt delay command
5  *
6  * 30 Aug 1999
7  *     started - Paolo Pantaleo <paolopan@freemail.it>
8  *
9  *
10  */
11
12 #include "config.h"
13
14 #ifdef INCLUDE_CMD_DELAY
15
16 #include <windows.h>
17 #include <tchar.h>
18 #include <stdlib.h>
19
20 #include "cmd.h"
21
22
23 INT CommandDelay (LPTSTR cmd, LPTSTR param)
24 {
25         DWORD val;
26         DWORD mul=1000;
27
28         if (_tcsncmp (param, _T("/?"), 2) == 0)
29         {
30                 ConOutPuts(_T(
31                               "pause for n seconds or milliseconds"
32                               "\n"
33                               "DELAY [/m]n\n"
34                               "\n"
35                               "  /m          specifiy than n are milliseconds\n"
36                               "              otherwise n are seconds"));
37                 return 0;
38         }
39
40         if (*param==0)
41         {
42                 error_req_param_missing ();
43                 return 1;
44         }
45
46         if (_tcsnicmp(param,_T("/m"),2) == 0)
47         {
48                 mul = 1;
49                 param += 2;
50         }
51
52         val = _ttoi(param);
53         Sleep(val*mul);
54
55         return 0;
56 }
57
58 #endif /* INCLUDE_CMD_DELAY */