home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
batnmore.z!p
/
CTRL-L.BTM
< prev
next >
Wrap
Text File
|
1992-11-15
|
4KB
|
99 lines
*REM This batch file is Freeware, free to use and redistribute unmodified *
*REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
REM Clear screen while preserving command line as it is.
REM Timestamp 15-Nov-1992
REM Note: *must* disable before using any program. Use at your own risk.
REM Note: there are a lot of troubles here, check end of this file.
REM Need ANSI.SYS compatible driver being able to redefine keyboard keys
REM and a grep command (you might want to replace it with find).
iff %_ansi==0 then^echo Need ANSI device driver^goto end^endiff
REM iff "%@search[find]"=="" then^echo Need FIND command^goto end^endiff
iff "%@search[fgrep]"=="" then^echo Need FGREP command^goto end^endiff
REM Is insert ON/OFF? Let's hope default setting is current setting, too.
REM setdos|*find "MODE="|set INSERT=%@substr[%@line[con,0],0,-1]
setdos|*fgrep -csx1 "MODE="|set INSERT=%@substr[%@line[con,0],0,-1]
iff "%INSERT"=="0" then^set INSERT=;0;82;^else^set INSERT=;^endiff
REM enable unixlike control-l. Note: *never* use inside any program. Never.
iff %@len[%@alias[·]] == 0 then
echos e[12;0;79;32;32;32;32;32;0;71%[INSERT]250;11;"·";13p
alias ·=keystack "*cls" 13 @73 10 @73 4 8 8 8 8 8 @71 @83 @79
echo Unixlike Ctrl-L ON
echo e[0;1;5;31;40m
echo ╔════════════════════════════════════════════════════════════════════════════╗
echo ║ e[0;1;37;40mNote: e[33m*must*e[37m be disabled before starting any program. e[33mUse at your own risk.e[5;31;40m║
echo ╚════════════════════════════════════════════════════════════════════════════╝
echos e[0m
else
REM disable unixlike control-l
echos e[12;12p
unalias ·
echos Unixlike Ctrl-L OFF
endiff
:end
quit
REM troublestroublestroublestroublestroublestroublestroublestroublestroubles:
REM problem1: what if command line is empty?
rem easy to fix, but depends on HistMin, which is.. now hardcoded to le 6
REM problem2: what if there is another command just alike? how exit history?
rem use unlikely chars, but what is unlikely somewhere else? Works here.
REM problem3: what if command is preceded by "@" and doesn't get recorded?
rem always insert 1 char in front (why not more? flickering..)
rem problem w/all above is limited command line lenght. Not likely to occur,
rem but if it does, control-l refuses to work, thanx to 4DOS.
REM problem4: is Insert on or off?
rem now hoping default setting is a correct guess.
rem if guessed wrong, will delete first character on command line.
REM problem4: how do I know, if key redefinition is allowed?
rem ...
REM trouble1: screen flickering (maybe e[8m etc.?). getting serious.
rem can I reduce size of history window? hide it? re-set screen contrast?
REM trouble2: how to select unique alias name? Now hardcoded to "·"
rem could try to misuse %@time[] in a loop until unique alias name found
rem then had to write that alias name into this file to remember it
REM Why Ctrl-Enter aka Ctrl-j doesn't work in string to-be-echoed?
rem echos e[12;32;32;32;32;32;0;71;0;82;250;11;"*cls";13;0;73;10;0;73;4;8;8;8;8;8:0;71;0;83;79;13p
rem alias tmps=1
rem maybe fixed in 4dos 4.01 rev D ?
REM WARNING: Why it is dangerous to use this batch file *and* start a program?
rem Because after you have run this batch file once, control-l is no more just
rem control-l, but instead a command string, which includes cursor movements,
rem character inserting and character deleting. When you run this batch file
rem for the second time, control-l will be restored back to just control-l.
REM Note: some Trojan Horses use key redefinition to erase hard disks.
rem If you have ANSI.SYS driver, which allows keyboard redefinition, *never*
rem "type" text files, always use text editor/viewer until you know there are
rem no suspicious ANSI escape sequencies. And read batch files before running
rem them. If you can't find out exactly what they do, don't run them. Do you
rem know what this batch file does? 4DOS has build-in "list" file viewer.
rem nnans992.zip is extremely fast ansi.sys replacement, which by default
rem *does not* allow keyboard redefinitions. Home users encouraged, business
rem users required US$10 right-to-use license. Check SIMTEL20 msdos/screen/