From f8ad495ac2c6d800efb90aafd27c9019a223724f Mon Sep 17 00:00:00 2001 From: Emanuele Aliberti Date: Sun, 18 Mar 2001 20:20:13 +0000 Subject: [PATCH] Really simple application that displays how much time elaped. svn path=/trunk/; revision=1713 --- reactos/apps/tests/alive/Makefile | 50 +++++++++++++++++++++++++++++++ reactos/apps/tests/alive/alive.c | 48 +++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 reactos/apps/tests/alive/Makefile create mode 100644 reactos/apps/tests/alive/alive.c diff --git a/reactos/apps/tests/alive/Makefile b/reactos/apps/tests/alive/Makefile new file mode 100644 index 00000000000..4f5c13e28c0 --- /dev/null +++ b/reactos/apps/tests/alive/Makefile @@ -0,0 +1,50 @@ +# +# +# +PATH_TO_TOP=../.. + +TARGET_NAME=alive + +OBJECTS=\ + ../common/crt0.o \ + $(TARGET_NAME).o + +LIBRARIES=\ + $(PATH_TO_TOP)/lib/kernel32/kernel32.a\ + $(PATH_TO_TOP)/lib/crtdll/crtdll.a\ + $(PATH_TO_TOP)/lib/user32/user32.a + +PROGS=\ + $(TARGET_NAME).exe + +BASE_CFLAGS = -I$(PATH_TO_TOP)/include + +all: $(PROGS) + +.phony: all + +clean: + - $(RM) $(TARGET_NAME).o + - $(RM) $(TARGET_NAME).exe + - $(RM) $(TARGET_NAME).sym + +.phony: clean + +install: $(PROGS:%=$(FLOPPY_DIR)/apps/%) + +$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: % + $(CP) $* $(FLOPPY_DIR)/apps/$* + +dist: $(PROGS:%=$(PATH_TO_TOP)/$(DIST_DIR)/apps/%) + +$(PROGS:%=$(PATH_TO_TOP)/$(DIST_DIR)/apps/%): $(PATH_TO_TOP)/$(DIST_DIR)/apps/%: % + $(CP) $* $(PATH_TO_TOP)/$(DIST_DIR)/apps/$* + +$(TARGET_NAME).exe: $(OBJECTS) + $(LD)\ + $(OBJECTS)\ + $(LIBRARIES)\ + -o $(TARGET_NAME).exe + $(NM) --numeric-sort $(TARGET_NAME).exe > $(TARGET_NAME).sym + +include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/apps/tests/alive/alive.c b/reactos/apps/tests/alive/alive.c new file mode 100644 index 00000000000..3bc5b2c0a12 --- /dev/null +++ b/reactos/apps/tests/alive/alive.c @@ -0,0 +1,48 @@ +/* $Id: alive.c,v 1.1 2001/03/18 20:20:13 ea Exp $ + * + */ +#include +#include + +HANDLE StandardOutput = INVALID_HANDLE_VALUE; +WCHAR Message [80]; +DWORD CharactersToWrite = 0; +DWORD WrittenCharacters = 0; +INT d = 0, h = 0, m = 0, s = 0; + +int +main (int argc, char * argv []) +{ + StandardOutput = GetStdHandle (STD_OUTPUT_HANDLE); + if (INVALID_HANDLE_VALUE == StandardOutput) + { + return (EXIT_FAILURE); + } + while (TRUE) + { + /* Prepare the message and update it */ + CharactersToWrite = + wsprintfW ( + Message, + L"Alive for %dd %dh %d' %d\" \r", + d, h, m, s + ); + WriteConsoleW ( + StandardOutput, + Message, + CharactersToWrite, + & WrittenCharacters, + NULL + ); + /* suspend the execution for 1s */ + Sleep (1000); + /* increment seconds */ + ++ s; + if (60 == s) { s = 0; ++ m; } + if (60 == m) { m = 0; ++ h; } + if (24 == h) { h = 0; ++ d; } + } + return (EXIT_SUCCESS); +} + +/* EOF */