Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!utcsri!utegc!utai!garfield!dalcs!dalcsug!kdavies From: kdavies@dalcsug.UUCP Newsgroups: comp.unix.questions,comp.unix.wizards,comp.lang.c Subject: Re: Filtering Everything Message-ID: <65@dalcsug.UUCP> Date: Fri, 17-Apr-87 12:04:52 EST Article-I.D.: dalcsug.65 Posted: Fri Apr 17 12:04:52 1987 Date-Received: Sat, 18-Apr-87 07:47:44 EST References: <919@watmum.UUCP> <6447@bu-cs.BU.EDU> Reply-To: kdavies@dalcsug.UUCP (Kevin Davies) Distribution: comp Organization: Dalhousie University, Halifax, N.S., Canada Lines: 40 Xref: utgpu comp.unix.questions:1738 comp.unix.wizards:1787 comp.lang.c:1661 Summary: filtering Xenix/Unix programs In article <6447@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes: > >>I wish to write a program in C that I can somehow set up so all output >>to my terminal goes through it first, and all input from my terminal goes >>through it too. > >You don't say what version of UNIX (maybe I should teach an Emacs key >to insert this at the top as a line eater giveaway :-) > >On SYSV I think you'll have difficulties doing what you say, especially >for terminal oriented programs (you mention vi.) > > -Barry Shein, Boston University Actually, I had to do a program like this under Xenix 3.0 using a C compiler that was ~1983 vintage. I had to "catch" all user input and had to "catch" all output from a program (this was for security reasons). (Neet way to let someone use vi without getting a 'shell' :-) Anyway, I worked just great. The program is run as a front-end and a back-end to the system program. The front-end sets the terminal in CBREAK mode (I think the back-end did too) and just did multiple getc's. And YES, it DOES work well with vi. Almost guaranteed to work under 4.x BSD, definitely SysV (any flavour). It doesn't use curses but does use the ioctl calls to set up the terminal. A great tool for security reasons -- that's why it was done in the first place. If enough are interested I will post it, otherwise I will email it. BEWARE: May not be the neatest (lintest?) program but it does the job. Oh, it forks itself and the system program. This could be changed with a line arguement I guess. -- Kevin Davies ...{seismo|watmath|utai|garfield} !dalcs!dalcsug!kdavies Kirk : "Spock, I do wish you'd stop using those colourful metaphors" Spock: "The _hell_ I will, Captain" ---------------------------------------------------------------