Minor improvements all around

Fixes a compiler warning about implicit declaration of fileno(), adds -W* CFLAGS to CMakeLists, fixes mixed declarations with code, silences a compiler warning about unused argc and argv in the example, and most importantly, fixes a bug where foreground color isn't reset until the next EOL.