NETOPRWA@ncsuvm.ncsu.edu (Wayne Aiken) (02/03/90)
In article <8200@bunny.GTE.COM> hhg1@GTE.COM (Hallett German) asks: >The sysop of NESUG BBS is trying to build a live door and has run into >this problem. He is using Microsoft C and wants to know how to redirect >without using CTTY. Your help is appreciated. Here is his note below: > >I would like to know the standard for writing a applications C program >which uses either the local screen or com1: for output automatically. > >Currently, I am using CTTY COM1: prior to execution and CTTY CON: after >execution of C program. Howvever, for security reasons this is not >recommended. Also this does not allow for the flexibility to run one >application program which will take care of both situations depending >on whether com1: is active. First: make sure the program traps Ctrl-C and other nasty characters which could abort the program, giving the remote user access to DOS. For the COM: port, I recommend using a device driver such as GATEWAY. When you do a CTTY to GATEx, all output (from stdout) is written both to the local screen and to the COM: port. Plus, both the local keyboard and the remote user can enter characters to the program. Then, do a CTTY CON: when the program is finished. Thus, the program doesn't have to know anything at all about the COM: port (except possibly monitoring Carrier Detect...) It's tough to write a program to monitor both local and/or remotes; and although this method still uses CTTY, the GATEWAY package seems relatively well-behaved and secure. If you still don't want CTTY, try doing a fprintf() with the device name instead of a file/stream pointer. This is available on SIMTEL20, or my BBS (919) 782-3095. I have no interest in GATEWAY other than a satisfied user. Wayne Aiken netoprwa@ncsuvm.bitnet "You can BE what PO Box 30904 netoprwa@ncsuvm.ncsu.edu you WON'T!!" Raleigh, NC 27622 wayne@shumv1.ncsu.edu --"Bob" (919) 782-8171 BBS: (919) 782-3095