Be const-correct.
(cherry picked from commit dc36952b0939aa7e41404f7c00219f933993f5af)
Introduce text mode to cf_popen and friends, for Windows support.

Part of issue 1884.
(cherry picked from commit a337311e7e96abfcaff3fa20cacf7a4ec1e260ae)
Use quoted path so "C:\Program Files" doesn't cause trouble.

Quoted paths are taken into account by the CommandArg0 function.

Part of issue 1884.
(cherry picked from commit 0f0cf01c21111cc2028cdf2edc46abd27bc33801)
Add usemodule autotest for both Unix and Windows.
(cherry picked from commit 673302d0b822487764337d85a3b8b71a0931516b)