summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/tclWinChan.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 2d6c42c..cca0dab 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -971,7 +971,7 @@ TclpOpenFileChannel(
switch (FileGetType(handle)) {
case FILE_TYPE_SERIAL:
/*
- * Natively named serial ports "com1-9", "\\\\.\\comXX" are
+ * Natively named serial ports "com1-9", "\\\\.\\comXX" are
* already done with the code above.
* Here we handle all other serial port names.
*
@@ -1525,12 +1525,11 @@ FileGetType(
* NativeIsComPort --
*
* Determines if a path refers to a Windows serial port.
- * A simple and efficient solution is to use a "name hint" to detect
- * COM ports by their filename instead of resorting to a syscall
+ * A simple and efficient solution is to use a "name hint" to detect
+ * COM ports by their filename instead of resorting to a syscall
* to detect serialness after the fact.
* The following patterns cover common serial port names:
- * COM[1-9]:?
- * //./COM[0-9]+
+ * COM[1-9]
* \\.\COM[0-9]+
*
* Results:
@@ -1550,33 +1549,26 @@ NativeIsComPort(
* 1. Look for com[1-9]:?
*/
- if ( (len >= 4) && (len <= 5)
- && (_wcsnicmp(p, L"com", 3) == 0) ) {
+ if ( (len == 4) && (_wcsnicmp(p, L"com", 3) == 0) ) {
/*
- * The 4th character must be a digit 1..9 optionally followed by a ":"
+ * The 4th character must be a digit 1..9
*/
-
+
if ( (p[3] < L'1') || (p[3] > L'9') ) {
return 0;
}
- if ( (len == 5) && (p[4] != L':') ) {
- return 0;
- }
return 1;
}
-
+
/*
- * 2. Look for //./com[0-9]+ or \\.\com[0-9]+
+ * 2. Look for \\.\com[0-9]+
*/
-
- if ( (len >= 8) && (
- (_wcsnicmp(p, L"//./com", 7) == 0)
- || (_wcsnicmp(p, L"\\\\.\\com", 7) == 0) ) )
- {
+
+ if ((len >= 8) && (_wcsnicmp(p, L"\\\\.\\com", 7) == 0)) {
/*
* Charaters 8..end must be a digits 0..9
*/
-
+
for ( i=7; i<len; i++ ) {
if ( (p[i] < '0') || (p[i] > '9') ) {
return 0;