home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
CUG
/
SOFTT-8.LBR
/
TEE.RAT
< prev
next >
Wrap
Text File
|
2000-06-30
|
1KB
|
35 lines
#-h- tee.r 718 local 12/24/80 15:08:32
# tee - copy standard input to named files and to standard output
# include ratdef
define(MAXFILES,16)
define(MAXNAME,FILENAMESIZE)
DRIVER(tee)
character c, getc, name(MAXNAME)
integer getarg, create, fdo(MAXFILES), i, nfiles
call query ("usage: tee files.")
for (i = 1; getarg(i, name, MAXNAME) ^= EOF; i = i + 1) {
if (i > MAXFILES)
call error("too many files.")
fdo(i) = create(name, WRITE)
if (fdo(i) == ERR)
call cant(name)
}
nfiles = i - 1
while (getc(c) ^= EOF) {
for (i = 1; i <= nfiles; i = i + 1)
call putch(c, fdo(i))
call putc(c)
}
for (i = 1; i <= nfiles; i = i + 1)
call close(fdo(i))
DRETURN
end
#-t- tee.r 718 local 12/24/80 15:08:32
#-t- tee 1725 local 12/24/80 15:54:41
743 local 12/24/80 15:08:31
d), STDOUT)
384