🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #7757

Re: tee for DOS?

#7757
From: donl mathis
Date: Tue, 26 Jan 1993 02:45
40 lines
1933 bytes
In article <1juom5INNgak@darkstar.UCSC.EDU>, spencer@cats.ucsc.edu
(Michael Spencer) writes:
|> 
|> 
|> esova@magnus.acs.ohio-state.edu (Edward R Sova) writes:
|> 
|> >Where can I get the Unix tee command for DOS?  You can split
redirection and
|> >piping.  like maybe foo | tee > prn >logfile.  Well I'm not sure of the 
|> >syntax, and I don't care right now, but I think you see what I want.  Where
|> >is it?  Thanx
|> 
|> Roll your own. Code goes something like this:
|> 
|> while (! feof(stdin))  {
|> 	fgets (str, 255, stdin);
|> 	fputs (str, stderr);		// send to screen
|> 	fputs (str, stdout);		// send whereever directed
|> 	}
|> fflush (stderr);
|> fflush (stdout);
|> close (dup(fileno(stdout)));		// ensure flushing on stdout

Note that these are not the "tee" semantics that we all know and love.
The command line is

	tee [ -i ] [ -a ] [ file ] ...

where -i is "ignore interrupts", which we don't care about, "-a" is to
append rather than overwrite existing files, and "file" and following
are the names of zero or more files into which a copy of stdin is
written, along with being sent to stdout.

So, technically, you'd want to open a vector of zero or more files, and
write each line into each of them as well as onto stdout.  This is a
few more lines of code, but still not exactly a nightmare.

- donl mathis at Silicon Graphics Computer Systems, Mountain View, CA
donl@sgi.com
Technical Details
Message-ID: <vbdgujg@zola.esd.sgi.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!sgigate!sgi!twilight!zola!glass.esd.sgi.com!donl
References: <1993Jan22.184439.27754@magnus.acs.ohio-state.edu> <1juom5INNgak@darkstar.UCSC.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!sgigate!sgi!twilight!zola!glass.esd.sgi.com!donl
From: donl@glass.esd.sgi.com (donl mathis)
Newsgroups: comp.os.msdos.programmer
Subject: Re: tee for DOS?
Message-ID: <vbdgujg@zola.esd.sgi.com>
Date: 26 Jan 93 02:45:17 GMT
References: <1993Jan22.184439.27754@magnus.acs.ohio-state.edu> <1juom5INNgak@darkstar.UCSC.EDU>
Sender: news@zola.esd.sgi.com (Net News)
Reply-To: donl@glass.esd.sgi.com (donl mathis)
Organization: Silicon Graphics, Inc.
Lines: 40