]> git.mdlowis.com Git - archive/afm.git/commitdiff
Added a running flag and tweaked to quit when the user hits 'q'
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 16 Jul 2014 23:13:05 +0000 (19:13 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 16 Jul 2014 23:13:05 +0000 (19:13 -0400)
.gitignore
Rakefile
source/main.c

index 4d40434d64211e92aee925553d1e87d57b0ed08d..8fe8049bcfad26b50938763beffd94414ec04a82 100644 (file)
@@ -21,3 +21,5 @@
 *.i*86
 *.x86_64
 *.hex
+build/
+.rsconscache
index c9666bbb0126844ebde71d156966a91dcb2851f3..82271cbb4a4513816cff731359f854416e5e75b2 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -21,7 +21,7 @@ at_exit { Env.process }
 #------------------------------------------------------------------------------
 # Rake Tasks
 #------------------------------------------------------------------------------
-#task :default
+task :default => [:build]
 
 desc "Build the AFM release binary"
 task :build do
index 4e7ed5a650b6872a0a22373c9a9dc74ed40d817c..45366f25b59c8f60b439db5d5c990268a5bdfc4e 100644 (file)
@@ -1,10 +1,23 @@
 #include <ncurses.h>
+#include <stdbool.h>
+
+bool Running = true;
+
+void handle_input(char ch) {
+    if(ch == 'q')
+        Running = false;
+}
 
 int main(int argc, char** argv) {
     initscr();
-    printw("Hello World !!!");
-    refresh();
-    getch();
+    raw();
+    keypad(stdscr, TRUE);
+    noecho();
+    printw("Hello, World! Please Press 'q' to quit.");
+    while(Running) {
+        refresh();
+        handle_input(getch());
+    }
     endwin();
     return 0;
 }