#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <termios.h>
#include <curses.h>
#include <sys/types.h>
#include <sys/time.h>

int main(int argc, char* argv[])
{
    fd_set mask;
    fd_set read_ok;
    int key;

    printf("\nHIT ANY KEY\n");

    initscr();

    FD_ZERO(&mask);
    FD_SET(0, &mask);

    read_ok = mask;
    select(1, &read_ok, NULL, NULL, NULL);

    key = getch();

    endwin();


/*

    int key;
    int meta;
    fd_set mask;
    fd_set read_ok;

    tcgetattr(STDIN_FILENO, &gTtySave);

    /// is terminal ///
    if(!isatty(0) || !isatty(1)) {
        fprintf(stderr, "standard input is not a tty\n");
        return 1;
    }

    printf("\nHIT ANY KEY\n");
    fflush(stdout);

    mcurses_init();

    minitscr();

    FD_ZERO(&mask);
    FD_SET(0, &mask);

    read_ok = mask;
    select(1, &read_ok, NULL, NULL, NULL);

    key = mgetch(&meta);

    mendwin();

    tcsetattr(STDIN_FILENO, TCSANOW, &gTtySave);

    mcurses_final();
 
*/
    return 0;
}

