Prefer c99 over gnu99
Fix some "copy, paste and don't change" errors
Remove superfluous strncpy
Allocate some small buffers on the stack