- From 0adf0953de799580c470d26975a1b81ba54db045 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 27 Nov 2024 10:16:12 +0100
- Subject: [PATCH] mount: nfs_mount.exe --help no longer works with wide-char
- stream mode
- nfs_mount.exe --help no longer works with wide-char stream mode.
- It seems all attemps to use single-byte functions like |printf()|
- after |_setmode(_fileno(stdout), _O_WTEXT);| will trigger an
- exception.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- mount/mount.c | 21 ++++++++++++++-------
- 1 file changed, 14 insertions(+), 7 deletions(-)
- diff --git a/mount/mount.c b/mount/mount.c
- index 7c8b0db..6537502 100644
- --- a/mount/mount.c
- +++ b/mount/mount.c
- @@ -79,11 +79,11 @@ void PrintErrorMessage(
- static
- void PrintMountUsage(LPWSTR pProcess)
- {
- - (void)fprintf(stderr,
- - "Usage: %S [options] <drive letter|*> <hostname>:<path>\n"
- - "Usage: %S [options] <hostname>:<path>\n"
- - "Usage: %S -d [options] <drive letter>\n"
- - "Usage: %S\n"
- + (void)fwprintf(stderr,
- + L"Usage: %s [options] <drive letter|*> <hostname>:<path>\n"
- + "Usage: %s [options] <hostname>:<path>\n"
- + "Usage: %s -d [options] <drive letter>\n"
- + "Usage: %s\n"
- "* Options:\n"
- "\t-h, --help, /?\thelp\n"
- @@ -173,8 +173,8 @@ void PrintMountUsage(LPWSTR pProcess)
- static
- void PrintUmountUsage(LPWSTR pProcess)
- {
- - (void)fprintf(stderr,
- - "Usage: %S [options] <drive letter>\n"
- + (void)fwprintf(stderr,
- + L"Usage: %s [options] <drive letter>\n"
- "* Options:\n"
- "\t-h, --help, /?\thelp\n"
- @@ -568,6 +568,13 @@ int __cdecl wmain(int argc, wchar_t *argv[])
- int crtsetdbgflags = 0;
- (void)setlocale(LC_ALL, "");
- + /*
- + * |_O_WTEXT| - set streams to wide-char mode so we print
- + * non-ASCII characters like Japanese or Chinese/GB18030
- + * correctly.
- + * Note that in CRT/UCRT any attempt to use single-byte
- + * functions like |printf()| will trigger an exception
- + */
- (void)_setmode(_fileno(stdout), _O_WTEXT);
- (void)_setmode(_fileno(stderr), _O_WTEXT);
- --
- 2.45.1
msnfs41client: Fix nfs_mount --help output
Posted by Anonymous on Wed 27th Nov 2024 09:39
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.