Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!linus!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.unix.questions Subject: Re: How do I wait for Terminal IO to compleate?? Message-ID: <740@mcgill-vision.UUCP> Date: Thu, 9-Apr-87 18:44:15 EST Article-I.D.: mcgill-v.740 Posted: Thu Apr 9 18:44:15 1987 Date-Received: Sun, 19-Apr-87 10:19:00 EST References: <245@uvicctr.UUCP> Organization: McGill University, Montreal Lines: 32 In article <245@uvicctr.UUCP>, sbanner1@uvicctr.UUCP (S. John Banner) writes: > I have been given the suggestion that I could just pause for a few > seconds, but that is klugy, and if I then go to a slower terminal (I > regularly use 9600baud, and 1200baud, but sometimes 300), I will have > to increase the delay, and I want the terminal to become free for > other users as quickly as possible. You could look at the baud rate and calculate the delay time. > I know that there is an ioctl that will see if there is any pending > input, but is there a similar one for output (I have looked, but I > can't find it). You don't say what sort of system you are on. Presumably it is some sort of UNIX. SysV? BSD4.2? BSD4.1? Xenix? what? There is such an ioctl. It is one of the less standard ioctls, and I would expect it only on BSD 4.2 and 4.3 (and derivatives): TIOCOUTQ. int charstoprint; ioctl(fd,TIOCOUTQ,&charstoprint); gives the number of characters queued up (waiting to print) in the kernel's output buffers for the tty the file descriptor refers to. I have no idea whether there is anything analagous in any other flavors of UNIX. der Mouse (mouse@mcgill-vision.uucp)