ReactOS  0.4.14-dev-49-gfb4591c
alive.c
Go to the documentation of this file.
1 #include <windows.h>
2 #include <stdlib.h>
3 
5 CHAR Message [80];
8 INT d = 0, h = 0, m = 0, s = 0;
9 
10 int
11 main (int argc, char * argv [])
12 {
15  {
16  return (EXIT_FAILURE);
17  }
18  while (TRUE)
19  {
20  /* Prepare the message and update it */
22  wsprintf (
23  Message,
24  "Alive for %dd %dh %d' %d\" \r",
25  d, h, m, s
26  );
27  WriteConsole (
29  Message,
32  NULL
33  );
34  /* suspend the execution for 1s */
35  Sleep (1000);
36  /* increment seconds */
37  ++ s;
38  if (60 == s) { s = 0; ++ m; }
39  if (60 == m) { m = 0; ++ h; }
40  if (24 == h) { h = 0; ++ d; }
41  }
42  return (EXIT_SUCCESS);
43 }
44 
45 /* EOF */
INT h
Definition: alive.c:8
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
char CHAR
Definition: xmlstorage.h:175
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
DWORD CharactersToWrite
Definition: alive.c:6
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
const GLfloat * m
Definition: glext.h:10848
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
INT m
Definition: alive.c:8
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
HANDLE StandardOutput
Definition: alive.c:4
smooth NULL
Definition: ftsmooth.c:416
INT d
Definition: alive.c:8
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EXIT_FAILURE
Definition: jerror.c:33
CHAR Message[80]
Definition: alive.c:5
INT s
Definition: alive.c:8
GLdouble s
Definition: gl.h:2039
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
#define WriteConsole
Definition: wincon.h:772
int main(int argc, char *argv [])
Definition: alive.c:11
#define wsprintf
Definition: winuser.h:5766
DWORD WrittenCharacters
Definition: alive.c:7