Skip to content
Tcl Source Code View Ticket
Login

View Ticket

fconfigure for serial ports failure

Closed / Fixed500348ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-01-07 11:06:15
Tcl version: Current 8.4 CVS, Windows

There is a bug in the TIP#35 implementation in
SerialSetOptionProc(): It occasionally modifies the 
'value' argument to upper case letters.
The following script demonstrates the problem:

set filename com1
proc openFile {} {
    global filename chan
    set chan [open $filename r+]
    fconfigure $chan -mode 9600,n,8,1    
    fconfigure $chan -handshake none
    fconfigure $chan -buffering none
}
openFile

[fconfigure -handshake none] modifies "none" to "NONE".
The following [fconfigure -handshake buffering none]
reuses the "NONE" value (when byte compiled) and fails.

The attached patch uses lower case comparison instead
of modifying the 'value' argument.

PS: Shouldn't Tcl_DriverSetOptionProc be better 
declared as 
(... const char *optionName, const char *value) ?
schroedterplain2002-01-07 18:06:16
File Added - 15613: tclWinSerial.c.patch
andreas_kupriesplain2002-01-08 04:17:23
Logged In: YES 
user_id=75003

Regarding the post-skriptum I believe that TIP #27 may 
apply. Please check with Kevin Kenny (kennykb) and Donald 
Porter (dgp).
andreas_kupriesplain2002-01-08 04:43:14
Logged In: YES 
user_id=75003

The definition of 'strCaseEqu' is not required. The C-
library provides 'strcasecmp' (or equivalent). This 
functionis in the stubs API and thus available, along 
with 'strncasecmp'.
schroedterplain2002-01-09 13:46:06
Logged In: YES 
user_id=99573

For Windows there is a strnicmp() function which could be 
used instead of strCaseEqu().
I see strncasecmp() in the tclPlatStubs API only for 
MAC_TCL.

I need the same for the Unix implementation of TIP#35.
Can I rely on strncasecmp() for all Unix*es ? 
My Linux manual says it's BSD 4.4.
andreas_kupriesplain2002-01-09 23:03:42
Logged In: YES 
user_id=75003

I believe "strcasecmp" and "strncasecmp" are available for 
all the major unices. There are implementations in 
the 'compat' directory which are used if 'configure' does 
not find these functions. Maybe even for Win*.
schroedterplain2002-01-10 13:26:11
Logged In: YES 
user_id=99573

Okay, here are the new patches:
Win32: using strnicmp()
Unix:   using strncasecmp()
schroedterplain2002-01-10 13:26:12
File Deleted - 15613: 



File Added - 15782: tclWinSerial.c.patch
schroedterplain2002-01-10 13:30:22
Logged In: YES 
user_id=99573

The Unix patches are submitted to patch #438509.
andreas_kupriesplain2002-01-12 03:19:51
Logged In: YES 
user_id=75003

Patch here comitted to head. The patches in #438509 are 
owned by Jeff.
Log in (anonymous is fine) to add a comment.

Attachments: