review and fix the logic when writing text oriented output in programs/* - some where using GetConsoleCP() or GetConsoleOutputCP() if WriteConsoleW fails; this is wrong as if WriteConsole failed, then it could mean that program isn't attached to a console (or here running under shell-no-window)... Luckily, in these cases, the returned value by GetConsole*CP() is 0, and CP_ACP is also 0... but it's likely not what was expected at first glance - testing under windows shows that it's rather GetOEMCP() which is used in those cases - simplified some code and checked for allocation failure where missing
Signed-off-by: Eric Pouech eric.pouech@gmail.com