[comp.sys.atari.st] Print redirection routine

ralph@lasso.UUCP (Ralph P. Sobek) (12/23/87)

I am quite new, and still naive, to my Atari ST.  I have programs that either
only output to the screen or to the printer port!  So as not to reinvent the
wheel, what I'm looking for is an assembler or C program which would redirect
the output of one of these programs to an ascii file rather than the printer.
You see, I don't have a printer locally on my Atari.  Thanks a million.

Merry Christmas,

	Ralph P. Sobek

UUCP:	mcvax!inria!lasso!ralph  or  ralph@lasso.UUCP
Internet:	lasso!ralph@{inria.inria.fr  or  uunet.UU.NET}
BITNET:	SOBEK@FRMOP11
ARPA:	sobek@shadow.Berkeley.EDU	(automatic forwarding)

ralph@lasso.UUCP (Ralph P. Sobek) (01/27/88)

Pleas excuse me folks if you've already seen the following message, but I've
never saw that it was echoed back to me in the Info-Atari16 Digest. (I've
been wondering about messages that reference the "line eater" in this list
[and *no* where else], but maybe he does exist :-).

Hope to hear from someone,

	--Ralph
= = = = = = = = = = = = = :
To: inria!score.stanford.edu!info-atari16
Subject: Print redirection routine

I am quite new, and still naive, to my Atari ST.  I have programs that either
only output to the screen or to the printer port!  So as not to reinvent the
wheel, what I'm looking for is an assembler or C program which would redirect
the output of one of these programs to an ascii file rather than the printer.
You see, I don't have a printer locally on my Atari.  Thanks a million.

Merry Christmas,

	Ralph P. Sobek

UUCP:	mcvax!inria!lasso!ralph  or  ralph@lasso.UUCP
Internet:	lasso!ralph@{inria.inria.fr  or  uunet.UU.NET}
BITNET:	SOBEK@FRMOP11
ARPA:	sobek@shadow.Berkeley.EDU	(automatic forwarding)

exodus@uop.edu (G.Onufer) (01/31/88)

In article <8801271313.AA10750@lasso.laas.fr>, ralph@lasso.UUCP (Ralph P. Sobek) writes:
> Subject: Print redirection routine
> I am quite new, and still naive, to my Atari ST.  I have programs that either
> only output to the screen or to the printer port!  So as not to reinvent the
> wheel, what I'm looking for is an assembler or C program which would redirect
> the output of one of these programs to an ascii file rather than the printer.
> You see, I don't have a printer locally on my Atari.  Thanks a million.
> 

Anybody think it would be possible to install a trap handler to intercept
the calls to output to the printer and send the output to a file?  Perhaps
a desk accessory (Yet Another DA!) like Tom Hudson's Hard Disk Write Protect
DA?  There are quite a few programs out there that do not have the option to
print to a file...and since I have an FX-80 and the school has a laser
printer, I usually try to print to a file and upload to the school's
system (The laser printer emulates an Epson in any case).

Any ideas?

Greg Onufer
exodus@uop.edu

ravi@mcnc.org (Ravi Subrahmanyan) (02/01/88)

## Subject: Print redirection routine
## wheel, what I'm looking for is an assembler or C program which would redirect
## the output of one of these programs to an ascii file rather than the printer.
## 
#
#Anybody think it would be possible to install a trap handler to intercept
#the calls to output to the printer and send the output to a file?  Perhaps


		Moshe Braner's program BARREL does exactly this.  It's
available from the Univ of Houston server (I think), among other places.
Check out the Info-Atari information posted a while back for some
details on how to contact the servers and other archives.

-ravi

wes@obie.UUCP (Barnacle Wes) (02/02/88)

In article <8801271313.AA10750@lasso.laas.fr>, ralph@lasso.UUCP (Ralph P. Sobek) writes:
> = = = = = = = = = = = = = :
> To: inria!score.stanford.edu!info-atari16
> Subject: Print redirection routine
> 
> what I'm looking for is an assembler or C program which would redirect
> the output of one of these programs to an ascii file rather than the printer.

You can redirect the output to printer in your program via the
following:

#define PRN 3
#define NULL ((char *) 0L)
...
	/*
	Put the command parameters in tail[1...].  tail[0] should
	equal the number of characters in the command tail, up to 127
	(I think - it seems to work).
	*/
	char tail[128];
...
	/*
	Force the printer handle to point to the disk file instead.
	*/
	Fforce(PRN, "disk:/file/name/path.ext");

	/*
	Now execute the program, the standard handles are inherited.
	*/
	Pexec(0, "disk:/program/name/path.prg", NULL, tail);
....

	Hope this helps whoever it was!

john@viper.Lynx.MN.Org (John Stanley) (02/08/88)

 >In article <8801271313.AA10750@lasso.laas.fr>, 
 >ralph@lasso.UUCP (Ralph P. Sobek) writes:
 >> To: inria!score.stanford.edu!info-atari16
 >> Subject: Print redirection routine
 >> 
 >> what I'm looking for is an assembler or C program which would redirect
 >> the output of one of these programs to an ascii file rather than the printer.

   The best program to accomplish this is called barrel written by
Moshe Braner.  It has several functions to allow capturing text or
screen dumps to a file.  It is TSR (terminate & stay resident) which
may or may not be what you originaly wanted, but it is good and it
works....


In article <15@obie.UUCP> wes@obie.UUCP (Barnacle Wes) writes:
 >You can redirect the output to printer in your program via the
 >following:
 >
[part of sample deleted]
 >	/* Now execute the program, the standard handles are inherited.  */
 >	Pexec(0, "disk:/program/name/path.prg", NULL, tail);
 >....
 >
 >	Hope this helps whoever it was!

  Not likely...  The example you gave will bomb miserably...  The
parameters you gave for Pexec are in the wrong order and ignore an
important pecularity in the Pexec call (the command tail is a Pascal
style string, not a C style string).

  The correct order for Pexec parameters is:
	Pexec mode:	zero is fine
	Program name:	standard C string format
	Command tail:	a pointer to a Pascal style string (a string 
			with the character count in the first byte!)
	Environment:	A pointer to an environment block or NULL if
			you want to use the default environment.

  Thus, a corrected version would read:

static unsigned char tailbuf[255];
....
tailbuf[0] = strlen(tail);
strcpy(tailbuf+1,tail);
Pexec(0, "A:\\folder1\\folder2\\program.ttp", tailbuf, (char*)NULL);



--- 
John Stanley (john@viper.UUCP)
Software Consultant - DynaSoft Systems
UUCP: ...{amdahl,ihnp4,rutgers}!meccts!viper!john

ralph@lasso.UUCP (Ralph P. Sobek) (02/17/88)

Thanks to all those who suggested me that I use Moshe Braner's BARREL.PRG
which I found amongst other files in MOSHE.UUE at Houston's ATARINET
server.  Thanks especially to Moshe Braner for having written it!!

According to BARREL.DOC, what is saved in the ramdisk is a compressed
SCODE format.  After writing to a file, that file needs to be decoded
with SDECODE.  What and where is SDECODE?  Could someone send it to me?
It does not seem to be on either of the BITNET servers, nor at Houston.

Thanks in advance,

Ralph P. Sobek

P.S.  I do not have access to the newsgroups (we don't have news, yet),
just Info-Atari16 Digest.  So send to the Digest and/or me.

=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
Ralph P. Sobek		       | UUCP:  uunet!mcvax!inria!lasso!ralph,    or
			       |        ralph@lasso.uucp
LAAS-CNRS		       | Internet:  ralph@lasso.laas.fr,    or
7, avenue du Colonel-Roche     |            ralph%lasso.laas.fr@uunet.UU.NET
F-31077 Toulouse Cedex, FRANCE | ARPA:   sobek@shadow.Berkeley.EDU (forwarded\
+(33) 61-33-62-66	       | BITNET/EARN:  SOBEK@FRMOP11        \ to UUCP )
=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =