Ticket #34510

Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

waitln command inputstr can contain several lines after a waitn command that times out

Open Date: 2014-10-19 06:08 Last Update: 2014-10-19 06:08

Reporter: gmmellem Owner: (None)
Type: Bugs Status: Open
Component: Tera Term Macro MileStone: (None)
Priority: 5 - Medium Severity: 5 - Medium
Resolution: None

Details

If you do a waitln command after a waitn command that times out inputstr may contain several lines of text. Following code example below shows the problem. Run the code with a loop back plug on COM (pin 2 connected to pin 3) and terminal transmit to CR + LF to visualize the problem better 1. time the loop runs, inputstr contain "secondline>" 2. time the loop runs, inputstr contain "firstline CRLF secondline>" The problem does not occur when waitn command does not time out.

I have looked at the code, and I think I have found the problem. If a waitn command find the number of bytes (result = 1) the ClearWaitN() function is run (line 164 in ttmmain.cpp). on the other hand if the function times out, ClearWaitN() if not run. This again cause the Receive line buffer not to be cleared inside PutRecvLnBuff(BYTE b) function when it should later in the waitln command (line 403 ttmdde.c is always false). I have inserted a ClearWaitN(); in line 441 ttmmain.cpp when waitn exit because of timeout. Compiled and tested that problem is gone. (however i do not know the code well enough to not guarantee that this modification don't have any unknown side effects)

Code example:

timeout = 1
for tmpcnt  1 2
    flushrecv
    sendln 'firstline'
    sendln 'secondline>'

    waitln '>'
    sprintf 'waitln %d.time inputstr [%s], result [%d]' tmpcnt inputstr result
    messagebox inputstr 'Test'
    
    waitn 1
next}}}

Attachment File List

No attachments

Ticket History (1/1 Histories)

2014-10-19 06:08 Updated by: gmmellem
  • New Ticket "waitln command inputstr can contain several lines after a waitn command that times out" created

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login