Revert patch for linebuf
Fix declarations to prototypes
Various fixes.
Revert some MSYS functionality because it wrong now.
Some fixes.