Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site cvl.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!uw-beaver!tektronix!hplabs!hao!seismo!rlgvax!cvl!jcw
From: jcw@cvl.UUCP (Jay C. Weber)
Newsgroups: net.micro.pc
Subject: Re: Am I in a pipe?
Message-ID: <1300@cvl.UUCP>
Date: Thu, 16-Aug-84 00:02:46 EDT
Article-I.D.: cvl.1300
Posted: Thu Aug 16 00:02:46 1984
Date-Received: Sun, 12-Aug-84 01:37:02 EDT
References: <204@shell.UUCP>
Organization: U. of Md. Computer Vision Lab
Lines: 15

Since in DOS 2.0 there is no difference between a pipe and redirection,
(except that pipe file names follow the %PIPEx.$$$ convention) you
can't tell the difference in a program, but you can tell whether
either stdin or stdout has been redirected through the IOCTL (int 21/44)
call [DOS manual, d-39].  Just do a get device information call on
file handles 0 and 1, and look at the ISDEV bit on each.  If it is 0,
you know it has been redirected.  To distinguish whether i/o has
been sent to another device, with ISDEV=1 look at ISCOT (is console
output) and ISCIN (is console input).

Jay Weber
..!seismo!rlgvax!cvl!jcw
jcw@cvl.arpa
..!seismo!rochester!jay
jay@rochester.arpa