Replace strndup() with malloc() + strncpy()

Otherwise MinGW freaks out about strndup().

This is meant to go with commit c621295bdc0a249024f91f4ec0f0c3a7487922f6
(NH4: Perform line wrapping for long messages).
Don't crash when PDCurses sends unexpected keys

This occurred when I pressed my laptop's Fn key.
Add install directory to .gitignore