Loop and monitor for key presses

Listing 2 shows the beginning of a while loop.

It continues to loop for as long as the user doesn't press the Esc key.

When the user presses the Esc key, the loop terminates.

Listing 2. Loop and monitor for key presses.
  while(!key[KEY_ESC]){//loop until user presses Esc key

    clear_keybuf();//clear old stuff from the buffer