1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-14 21:47:19 +02:00

common: First take on handling Unicode command line args.

* common/w32-misc.c: New.
* common/t-w32-cmdline.c: New.
* common/init.c: Include w32help.h.
(prepare_w32_commandline): New.
(_init_common_subsystems) [W32]: Call prepare_w32_commandline.

* common/Makefile.am (common_sources) [W32]: Add w32-misc.c
(module_tests): Add t-w32-cmdline
(t_w32_cmdline_LDADD): New.
--

The rules for the command line parser are not cleary specified - if at
all.  See the comment in t-w32-cmdline.c.

We can't use the mingw version because that would require to change
all argv handling to be wchar_t and that only for Windows.  That would
be too ugly.  Parsing the command line into argv by us is much easier
and we can do that only if needed - i.e. if globing is required (we
are prepared for this) or a non-ASCII character has been encountered.
This way we keep things stable and only fix the currently not working
Unicode problem.

GnuPG-bug-id: 4398
(cherry picked from commit deb6c94362)
This commit is contained in:
Werner Koch 2021-03-04 10:16:48 +01:00
parent 1f59c4c8e2
commit 90ddd1cf13
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
5 changed files with 459 additions and 6 deletions

View file

@ -102,7 +102,7 @@ common_sources = \
if HAVE_W32_SYSTEM
common_sources += w32-reg.c
common_sources += w32-reg.c w32-misc.c
endif
# To make the code easier to read we have split home some code into
@ -168,7 +168,7 @@ module_tests = t-stringhelp t-timestuff \
t-convert t-percent t-gettime t-sysutils t-sexputil \
t-session-env t-openpgp-oid t-ssh-utils \
t-mapstrings t-zb32 t-mbox-util t-iobuf t-strlist \
t-name-value t-ccparray t-recsel
t-name-value t-ccparray t-recsel t-w32-cmdline
if !HAVE_W32CE_SYSTEM
module_tests += t-exechelp t-exectool
endif
@ -222,6 +222,9 @@ t_name_value_LDADD = $(t_common_ldadd)
t_ccparray_LDADD = $(t_common_ldadd)
t_recsel_LDADD = $(t_common_ldadd)
t_w32_cmdline_SOURCES = t-w32-cmdline.c w32-misc.c $(t_extra_src)
t_w32_cmdline_LDADD = $(t_common_ldadd)
# System specific test
if HAVE_W32_SYSTEM
t_w32_reg_SOURCES = t-w32-reg.c $(t_extra_src)