Did you move the call to glutKeyboardFunc() to after glutInit()
as suggested by S_M_A ?

Also, that does not catch match clicks. To process mouse clicks use
glutMouseFunc()