comparison src/iscygpty.c @ 33625:1ffdcd8a424e v9.0.2054

patch 9.0.2054: win32: iscygpty needs update Commit: https://github.com/vim/vim/commit/ac709e2fc0db6d31abb7da96f743c40956b60c3a Author: Ken Takata <kentkt@csc.jp> Date: Fri Oct 20 11:54:05 2023 +0200 patch 9.0.2054: win32: iscygpty needs update Problem: win32: iscygpty needs update Solution: Update iscygpty to the latest version, make use iswascii() API function Import the latest version from https://github.com/k-takata/ptycheck. This addresses #13332 for iscygpty() closes: #13392 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ken Takata <kentkt@csc.jp>
author Christian Brabandt <cb@256bit.org>
date Fri, 20 Oct 2023 12:00:05 +0200
parents faf7fcd1c8d5
children
comparison
equal deleted inserted replaced
33624:420ceec75ea7 33625:1ffdcd8a424e
1 /* 1 /*
2 * iscygpty.c -- part of ptycheck 2 * iscygpty.c -- part of ptycheck
3 * https://github.com/k-takata/ptycheck 3 * https://github.com/k-takata/ptycheck
4 * 4 *
5 * Copyright (c) 2015-2017 K.Takata 5 * Copyright (c) 2015-2023 K.Takata
6 * 6 *
7 * You can redistribute it and/or modify it under the terms of either 7 * You can redistribute it and/or modify it under the terms of either
8 * the MIT license (as described below) or the Vim license. 8 * the MIT license (as described below) or the Vim license.
9 * 9 *
10 * Permission is hereby granted, free of charge, to any person obtaining 10 * Permission is hereby granted, free of charge, to any person obtaining
114 { 114 {
115 #ifdef STUB_IMPL 115 #ifdef STUB_IMPL
116 return 0; 116 return 0;
117 #else 117 #else
118 HANDLE h; 118 HANDLE h;
119 int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1); 119 const int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1);
120 FILE_NAME_INFO *nameinfo; 120 FILE_NAME_INFO *nameinfo;
121 WCHAR *p = NULL; 121 WCHAR *p = NULL;
122 122
123 setup_fileid_api(); 123 setup_fileid_api();
124 124
133 nameinfo = malloc(size + sizeof(WCHAR)); 133 nameinfo = malloc(size + sizeof(WCHAR));
134 if (nameinfo == NULL) { 134 if (nameinfo == NULL) {
135 return 0; 135 return 0;
136 } 136 }
137 // Check the name of the pipe: 137 // Check the name of the pipe:
138 // '\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master' 138 // "\\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master"
139 if (pGetFileInformationByHandleEx(h, FileNameInfo, nameinfo, size)) { 139 if (pGetFileInformationByHandleEx(h, FileNameInfo, nameinfo, size)) {
140 nameinfo->FileName[nameinfo->FileNameLength / sizeof(WCHAR)] = L'\0'; 140 nameinfo->FileName[nameinfo->FileNameLength / sizeof(WCHAR)] = L'\0';
141 p = nameinfo->FileName; 141 p = nameinfo->FileName;
142 if (is_wprefix(p, L"\\cygwin-")) { // Cygwin 142 if (is_wprefix(p, L"\\cygwin-")) { // Cygwin
143 p += 8; 143 p += 8;
145 p += 6; 145 p += 6;
146 } else { 146 } else {
147 p = NULL; 147 p = NULL;
148 } 148 }
149 if (p != NULL) { 149 if (p != NULL) {
150 while (*p && isxdigit(*p)) // Skip 16-digit hexadecimal. 150 // Skip 16-digit hexadecimal.
151 while (*p && iswascii(*p) && isxdigit(*p))
151 ++p; 152 ++p;
152 if (is_wprefix(p, L"-pty")) { 153 if (is_wprefix(p, L"-pty")) {
153 p += 4; 154 p += 4;
154 } else { 155 } else {
155 p = NULL; 156 p = NULL;
156 } 157 }
157 } 158 }
158 if (p != NULL) { 159 if (p != NULL) {
159 while (*p && isdigit(*p)) // Skip pty number. 160 // Skip pty number.
161 while (*p && iswascii(*p) && isdigit(*p))
160 ++p; 162 ++p;
161 if (is_wprefix(p, L"-from-master")) { 163 if (is_wprefix(p, L"-from-master")) {
162 //p += 12; 164 //p += 12;
163 } else if (is_wprefix(p, L"-to-master")) { 165 } else if (is_wprefix(p, L"-to-master")) {
164 //p += 10; 166 //p += 10;