-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the curses API rather than depend on the tput
command
#1460
Comments
and you believe Korn (or whoever) used that var if something is "gross" around here, it is not the ksh93 code base but your careless/clueless approach. looking forward to the next regression introduced by this. |
Notice also that the code only runs
Which is probably why they shelled out to run |
The reason to abuse Regarding the use of the A slight problem here is that This code is
"cuu1" terminfo and "up" termcap properties seem to be either We could probably add the |
Issue #1459 caused me to notice that this block of code is, at best, confusing:
ast/src/cmd/ksh93/edit/edit.c
Lines 454 to 464 in 1fd82bd
The problem is that it is assigning to shell var
.sh.subscript
a value having absolutely nothing to do with the documented meaning of that var. The code could have used literally any arbitrary, otherwise ostensibly private, var to temporarily hold the value returned bytput cuu1
. Abusing.sh.subscript
is gross and unnecessary. It's also dangerous since, theoretically, it could have been set prior to that block of code being run. Which, again, illustrates that the old AST team relied far too much on knowledge of the existing implementation rather than first principals when writing such code.We should modify ksh to not use the
tput
command in this fashion. Ksh should be using the curses API to get this info rather than running an external command. Note that there are only two places in the code that use an externaltput
command in this fashion. The other being inemacs_escape()
to runtput clear
when [ctrl-L] is seen. Which means that if atput
command wasn't found when the build was configured you can't use [ctrl-L] to clear the screen. Which seems suboptimal and needlessly expensive. Not to mention that even iftput
was found when the build was configured there is no guarantee it will be in$PATH
when it is needed. Which explains the2>/dev/null
redirection in theed_setup()
function. But not why the same redirection isn't present in theemacs_escape()
function.The text was updated successfully, but these errors were encountered: