Win32: Unicode arguments and environment
commit0c2c850f341aee398a7c04cdaa1a4f31d3ddeb51
authorKarsten Blees <blees@dcon.de>
Fri, 7 Jan 2011 20:18:12 +0000 (7 21:18 +0100)
committerKarsten Blees <blees@dcon.de>
Sat, 8 Jan 2011 16:30:19 +0000 (8 17:30 +0100)
tree3d72ead01b9f7893d2553effd515b6762ea4f957
parent31b0c949cb6e48b92b5f7c8a84e3e063f8dd6764
Win32: Unicode arguments and environment

Convert command line arguments and environment from UTF-16 to UTF-8 on
startup, and vice versa when creating other processes.

Provide replacements for getenv/putenv/unsetenv that operate directly on
the UTF-8-encoded "environ" array to save UTF-8/16 conversions on each
call (and save the trouble to keep track of conversion memory). As sorting
the environment is required for CreateProcess anyway, keep "environ"
sorted and use binary search for faster lookups.

The mingw_startup function converts the command line and environment to
UTF-8, and fixes Windows specific environment settings (TMPDIR and TERM,
formerly handled in mingw_getenv).

Altering the environment when creating new processes is now handled in
spawnv* internally, replacing make_augmented_environ and related APIs.

Signed-off-by: Karsten Blees <blees@dcon.de>
Makefile
compat/mingw.c
compat/mingw.h
run-command.c