Xref: utzoo comp.unix.shell:641 comp.unix.misc:390 comp.unix.internals:739 Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!rutgers!njin!uupsi!sunic!news.funet.fi!funic!fuug!demos!avg From: avg@hq.demos.su (Vadim G. Antonov) Newsgroups: comp.unix.shell,comp.unix.misc,comp.unix.internals Subject: Re: Questions about rewriting the History function. Message-ID: <1990Oct20.143032.25212@hq.demos.su> Date: 20 Oct 90 14:30:32 GMT References: <1990Oct19.170143.7674@polyof.poly.edu> Reply-To: avg@hq.demos.su (Vadim G. Antonov) Organization: DEMOS, Moscow, USSR Lines: 37 In article <1990Oct19.170143.7674@polyof.poly.edu> mhoffman@george.poly.edu writes: > > I am working on a senior project to rewrite the history function for UNIX. My goal is to have the new history functon work like it does in MS_DOS. >i.e. I want to be able to call up past commands and edit them by using the >control characters. Additionally, I would like to write this as a stand alone program so that I do not have to rewrite the shell. I've written the such program (it's about 50 lines :-) sorry but I haven't it handy. To use it one should add the following alias to .cshrc: alias r 'eval `history | redo`' so if you want to edit previous lines you should enter the command r. This program was died because we (Sergey Ryzhkov & I) have made our own revision of csh with builtin line-editing facility. (So there is no need to enter commands to go to editing mode). It was not so simple because Unix tty drivers handle modes switching in the very *ugly* way - I've spent a week trying to make a sequence allowing do it without flushing characters. (Oh I use to type commands *before* a prompt appears :-). Another problem was the proper processing of ^Z and ^Y - some our ttys used this chars (as well as ^Q and ^S) in escape sequences. We decided to read all characters as ordinary ones and process it in program - and I had to hack tty driver to allow TIOCSTART and TIOCSTOP to work with ordinary ttys as well as with ptys. Problem with ^Z/^Y was solved by non-trivial hack in csh's internals. Anyway it was done and works under DEMOS 2.2. Thus I suggest you to do the thing in the first way, it's much simplier and practically as suitable as the second for an endluser. Vadim Antonov DEMOS, Moscow, USSR