Re: [SLUG] A simple script and printing question (?)

From: Eben King (eben1@tampabay.rr.com)
Date: Thu Apr 13 2006 - 13:05:41 EDT


On Thu, 13 Apr 2006, Macy1 Hallock wrote:

> Eben King wrote:
>> On Wed, 12 Apr 2006, Macy1 Hallock wrote:
>>
>>>
>>> I'm hacking a vendors ancient COBOL program output to print using lpr (via
>>> cups) in Fedora.
>>> Given a program output similar to that produced by "cat textfile.txt >"
>>> If I append the sting "/dev/ttyS01" it prints to the serial port. But I
>>> want to print using the cups spooler. I can't using lpr, because the pipe
>>> metacharacter won't function.
>>> So, how can I print the stdout via lpr under cups, not using a pipe?
>>> Note that I can't modify the command shown in quotes, I can only append to
>>> it, and there's a 15 character field limit to boot.
>>
>> Dump to a temp file, and print that? "cat textfile.txt >/tmp/x;lpr x" will
>> fit (10 chars) and sorta work. Unless /tmp/x already exists. Don't know a
>> way to cram even basic security in 15 chars.
> Clever enough, but doesn't work. Since I'm submitting a destination to a
> redirect, the semicolon does not work for command chaining.

OK, how about a wrapper then? In your wrapper script, run

cp /dev/null /tmp/foo
chmod 600 /tmp/foo

then tell the program to write to /tmp/foo, then in the wrapper run

lpr /tmp/foo

> Both Eben and Wayne suggested using a named pipe, which I thought would be a
> good solution. However, it does not work, error message returned by cups is
>
> lpr: unable to print file: client-error-bad-request

Of course, if the program repeatedly does something like (open the file,
send som text, close the file), then maybe something like "tail -f" is in
order. I wonder what lpr's beef was. Is there anything in a log?

Maybe you can use the "named pipe" trick, with a script reading from it,
writing whatever it reads to a file, and later printing that file.

Does this COBOL program output text or binary data?

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar

Logic is a systematic method of coming to ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:28:04 EDT