jimc@haddock (05/20/86)
Earlier on, an Steve Lademann reported to net.bugs an error in Bell System V software. In recapitulation, this observant programmer noticed that when a key is pressed and the available keypad keys are searched, the loop terminates improperly in that search if the key is not known. Here is an excerpt from his report: > This is due to a bad condition on a 'for' loop at line 111 (or > thereabouts). The condition reads. > > for(i=0; SP->kp[i].keynum >= 0; i++) > > which causes it to whiz off through memory looking for a key which is > numbered negatively, whereas the code marks the entry after the last > key in the array as 0. > > The (obvious) cure is therefore > > for(i=0; SP->kp[i].keynum > 0; i++) > > > ----------------------------------------------------------------- > |Steve Lademann |Phone: 44 727 59292 x326 | > |Marconi Instruments Ltd|UUCP : ...mcvax!ukc!hrc63!miduet!steve | > |St. Albans |NRS : steve@uk.co.gec-mi-ate.mifnet | > |Herts. UK | | > ----------------------------------------------------------------- > |"The views expressed herein do not necessarily reflect"| | > |"those of my employer, and may not even reflect my own"| | > ----------------------------------------------------------------- > I did some investigating, and it does seem correct that the wgetch() routine does not have a proper termination condition, as reported, but I found it impossible to get that to produce a problem when all the keys on the terminal are known to the curses software, that is, when _init_keypad() is defined to encompass all the keys on a particular keyboard. Under those circumstances, every search is successful and the end of the list is never reached. Steve, did you use an _init_keypad() that does not cover all the keys you have available on your keyboard, and if so, did the core dump occur only when you pressed one of those unknown keys? Does anyone else in net-land have some experience with this? ______________________________ Jim Campbell {decvax ! cca | yale | ihnp4 | cbosgd}!ima!jimc {bbncca | harvard | zurton | cfib | mit-ems | wjh12 }!ima!jimc {uscvax | ucla-vax | vortex}!ism780!jimc INTERACTIVE Systems, 7th floor, 441 Stuart St, Boston, MA 02116; 617-247-1155