[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference kernel::unix_printing

Title:Printing from UNIX
Moderator:KERNEL::COFFEYJ
Created:Thu Dec 17 1992
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:956
Total number of notes:2876

934.0. "ESCAPE SEQUENCES PASSED TO FILTER" by IB001::ANAMARIA () Fri Apr 11 1997 15:32

	Hi all.

	I'm trying to pass some escape sequences at the beginning and end of a 
file to be printed. Something similar to the following but through a program 
behaving as a filter:

	* Script 'ADDESC.csh'
	#!/bin/csh
	/bin/cat /usr/lbin/escape1 | cat - $1 | cat - /usr/lbin/escape2

	where

	'escape1' contains the escape sequence to be written at the beginning 
of the file

	'escape2' contains the escape sequence to be written at the end of the 
file.

	When you execute:

	#addesc.csh file_test

the results are as expected:

	<contents_of_file_'escape1'>
	<contents_of_'file_test'>
	<contents_of_file_'escape2'>

	Under this idea and taking into account that the transparent filter 
outputs to the standard output exactly what it receives through its standard 
input, I have modified the transparent filter to redirect the standard input 
(the file to be printed sent by the 'lpd' daemon) to a temporal file to be 
passed to the above commands. For example:

		Transparent filter modified:
	#!/sbin/csh
	/bin/cat 1>out.tmp
	/bin/cat /usr/lbin/escape1 | cat - out.tmp | cat - /usr/lbin/escape2

but this doesn't work.

	Could somebody answer me the following questions?.

	- How does the 'lpd' daemon really works and how the file to be 
printed is passed to the filter associated to the printer?

	- Is it possible to do what I intend to do (to pass escape sequences 
to the beginning and end of the file to be printed)?

	Any help will be very appreciated.

	Thanks in advance.

	Regards.


						Ana
T.RTitleUserPersonal
Name
DateLines
934.1try this script as the input filterSMURF::LABONTEFri Apr 11 1997 18:285
#!/usr/bin/csh
setenv CMD_ENV bsd
/usr/bin/echo -n "\033E"
/bin/cat
/usr/bin/echo -n "\033E"
934.2IT DOESN'T WORK. ANYTHING WRONG??IB001::ANAMARIAMon Apr 14 1997 14:1629
    	Hi.
    
    	Thanks for your quick answer.
    
    	I have tried both your example in .1 and a modification of it,
    substituting both the "\033E" by two different strings. For example:
    
    #!/usr/bin/csh
    setenv CMD_ENV bsd
    /usr/bin/echo -n "BEGIN"
    /bin/cat
    /usr/bin/echo -n "END"
    
    and the file to be printed has the following information:
    
    	TEXT
    
    but, when I print the text with that input filter, the data file 
    (dfA022contento.sqo.dec.com) has only the contents of the file to be
    printed (nothing about the 'echo' messages).
    
    	What am I doing wrong?
    
    	Thank you very much in advance.
    
    	Regards.
    
    					Ana.
    
934.3SMURF::LABONTEMon Apr 14 1997 18:389
It should work. I used lpf as the output filter and the script as the input
filter. I entered the command `echo "***" | lpr -h'. to test the filter.

Lets start at the beginning.

        - What kind of printer.
        - What kind of file/files are you trying to print.
        - What is the specific problem are you trying to resolve by
          wrapping the file with an escape sequence.
934.4THIS IS THE PROBLEM.IB001::ANAMARIATue Apr 15 1997 12:5931
    	Hi.
    
    	This is the customer need:
    
    	From an Informix application, the customer chooses a print option
    that prints (in a HPlaserjet II) some information contained in an ASCII 
    file generated by the application.
    
    	Currently, some listings don't fit the paper width and the customer
    wants to compress the data using the corresponding escape sequence for
    that printer.
    
    	We made some tests editing the file generated by the application,
    entering the escape sequence for compression at the beginning of the
    file and the reset escape sequence at the end of the file, and printing
    it from the operating system prompt, and the file printed OK, just as
    the customer wanted.
    
    	Now, as this manual intervention can not be done with each
    individual file to be printed, we'd need a way a print filter could
    pass this escape sequences directly to the file without any need to
    use pipes, as you suggested in .3. I don't know if this is possible or
    not.
    
    	Anyway, I'll test what you suggested in .3, although it's not
    exactly what the customer wants.
    
    	If you have any doubts, please let me know.
    
    	Thanks in advance.
    						Ana