Is it possible to get Windows + tcl + tcl expect session to not wrap lines at 80 columns?
I've spent a couple of days over past few months blipping into try and investigate and solve this but for a simple/stupid thing it's proving troublesome.
Somewhere in a tcl + tcl expect function which telnet's into qnx hardware cards or VMs:
# I had a big argument trying to get tcl+expect to set it's session to not t
# runcate columns at 80 chars (which causes various annoying parsing difficu
# lties). No matter what teminal tcl script was invoked from or what termina
# l environment/settings were used the expect session negotiated at telnet p
# rotocol level a terminal with 80 chars width. Also could not solve problem
# with sttying and setting terminal environment on qnx after login.
# If anyone can solve this please send info.
Wrapping at 80 chars is very annoying isn't it! But more annoying for trying to parse command-line interaction in a reliable way. Surely this has been solved by someone before? But after googling and grepping web it appears it might not have been ever solved + published on teh hinternet (in keeping with the tcl philosophy of hack it and get it working messily and move on).
# Wherever tcl is invoked from terminal then settings are passed through int
# o tcl process (environment set, terminal escapes, stty), and THESE are pas
# sed into telnet process invoked by tcl. BUT tcl + expect + telnet windows
# telnet sends NegotiateWindowSize 80x25 no matter what else is done.
# If a telnet session running in windows terminal or putty has window resize
# then telnet option messages are sent again. For now I can't find how to te
# ll that telnet session to set column width. Setting stty rows/cols or send
# ing ansi escape sequences doesn't seem to have an effect.
I have some wireshark logs with the telnet negotiation packets captured. I suppose we also have tcl expect source code ... but it is the telnet invoked which queries the environment it has and decides column setting to use.
# This causes Invalid telnet packet sent:
# sent telnetSuboptionBegin Negotiate about window size
# width \x02\x00 height \x00\x35
stty-ing (or changing terminal program used) before tcl called or inside tcl before expect session started or sending ansi/other ESC sequences didn't work for me.
# stty rows 52 columns 512 < $spawn_out(slave,name)
# log::logarray expect_out
# log::logarray spawn_out
#LOG: log::logarray:spawn_out(slave,name) = ExpectInjector_pid8148
#?×?×?×8L?×ÐÝ: redirection not supported on Windows NT
#(ù8ùHùàmXùhùÀn: redirection not supported on Windows NT
Tried lots of different things but need to collect information on what works and how it works:
[Windows application] - [tclsh - [tcl expect - [spawn telnet]]] - [QNX VM or hardware]
Try Windows application =
eclipse (running tcl with DLTK plugin)
Try outside tcl telnet in from each application, then each of these:
* resizing window possible? + results in line wrapping? Negotiated at telnet level?
* stty settings before telnet
* stty settings on qnx after telnet in
* control using ansi ESC codes: disable line wrap OR set terminal width (OR other settings)
Try inside tcl invoked from each application and try each of the above and add:
* in tcl set stty things
* in tcl set environment things
* in tcl expect set things
Last thing: try all of the above from a linux machine with equivalent linux applications (terminal tool, xterm, eclipse).
Too many variants affect the problem!
It comes down to what qnx's bash does with it's output SO would be good if we could start there.
So ansi ESC codes / environment settings?