From: Michael D. Lowis Date: Wed, 16 Jul 2014 23:13:05 +0000 (-0400) Subject: Added a running flag and tweaked to quit when the user hits 'q' X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=74583118deedd18d446fc3df17e5b7b832650b9f;p=archive%2Fafm.git Added a running flag and tweaked to quit when the user hits 'q' --- diff --git a/.gitignore b/.gitignore index 4d40434..8fe8049 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ *.i*86 *.x86_64 *.hex +build/ +.rsconscache diff --git a/Rakefile b/Rakefile index c9666bb..82271cb 100644 --- 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 diff --git a/source/main.c b/source/main.c index 4e7ed5a..45366f2 100644 --- a/source/main.c +++ b/source/main.c @@ -1,10 +1,23 @@ #include +#include + +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; }