Fix some scan-build detected issues.

Fix potential crash when parsing unknown long options. Silence a few
warnings.
Optimize ‘gl_lightmap 1’ drawing.
Fix writing semicolon binding to config.
Make key bindings case insensitive.

Handling Shift modifier for keybindings is a flawed approach: actions
are supposed to be bound to physical keys. If there is any need for
modifier keys, they can be emulated with scripting magic.