title: Up button should bring previous passed commands
body: <p>so I am designing an application, where similar to bash, when the user presses the up and down keys, the previously passed input(or commands) should be printed. I know Java has key listeners, but I have no clue how to do this in C.</p>