Thread View: news.software.readers
9 messages
9 total messages
Started by Will Estes
Sun, 04 Oct 1992 21:34
Printing From trn?
Author: Will Estes
Date: Sun, 04 Oct 1992 21:34
Date: Sun, 04 Oct 1992 21:34
5 lines
705 bytes
705 bytes
How does one print an article from trn? Where do you set the print string? Thanks, Will Estes Internet: westes@netcom.com
Re: Printing From trn?
Author: David Barr
Date: Sun, 04 Oct 1992 22:13
Date: Sun, 04 Oct 1992 22:13
9 lines
908 bytes
908 bytes
In article <1992Oct4.213425.3041@netcom.com> westes@netcom.com (Will Estes) writes: >How does one print an article from trn? Where do you set the print >string? | lpr --Dave -- System Administrator, Population Research Institute barr@pop.psu.edu
Re: Printing From trn?
Author: Robert Hood
Date: Mon, 05 Oct 1992 01:41
Date: Mon, 05 Oct 1992 01:41
41 lines
1849 bytes
1849 bytes
In article <_4x1Hg08&9@atlantis.psu.edu> barr@pop.psu.edu (David Barr) writes:
>In article <1992Oct4.213425.3041@netcom.com> westes@netcom.com (Will Estes) writes:
>>How does one print an article from trn? Where do you set the print
>>string?
>
>| lpr
This won't work on Netcom, since our users dial in from home/work, and
don't have access to our printers.
Attached is a little C program I use to print to my local printer.
Basically, it isues a VT100 printer-on escape sequence, sends the data, then
isues a VT100 printer-off escape squence. Make sure your terminal
emulator supports this.
I call it "lprint", so from trn, I can type "| lprint", and the article will
be printed to my printer.
#include <stdio.h>
main ()
{
int in;
/* turn on printer */
putchar (27);
putchar ('[');
putchar ('5');
putchar ('i');
while ((in = getc (stdin)) >= 0)
{
putchar (in);
}
putchar (27);
putchar ('[');
putchar ('4');
putchar ('i');
}
--
Robert Hood hoodr@netcom.com (408) 554-UNIX
System/Network Administrator for Netcom On-line Communications Services
Re: Printing From trn?
Author: Will Estes
Date: Mon, 05 Oct 1992 23:41
Date: Mon, 05 Oct 1992 23:41
13 lines
1136 bytes
1136 bytes
barr@pop.psu.edu (David Barr) writes: >In article <1992Oct4.213425.3041@netcom.com> westes@netcom.com (Will Estes) writes: >>How does one print an article from trn? Where do you set the print >>string? >| lpr So far so good. But your solution leads me to my next question: how do I configure trn so that it uses csh instead of sh as the environment in which to execute the piped command? Thanks!
Re: Printing From trn?
Author: David Barr
Date: Tue, 06 Oct 1992 15:30
Date: Tue, 06 Oct 1992 15:30
26 lines
1621 bytes
1621 bytes
In article <1992Oct5.234128.17631@netcom.com> westes@netcom.com (Will Estes) writes: >barr@pop.psu.edu (David Barr) writes: > >>In article <1992Oct4.213425.3041@netcom.com> westes@netcom.com (Will Estes) writes: >>>How does one print an article from trn? Where do you set the print >>>string? > >>| lpr > >So far so good. But your solution leads me to my next question: how do I configure >trn so that it uses csh instead of sh as the environment in which to >execute the piped command? did you try: setenv SHELL /bin/csh ? (This is all rather clearly documented in the man page) Why do you need csh in this case, anyway? --Dave -- System Administrator, Population Research Institute barr@pop.psu.edu Contains: Carbonated water, high fructose corn syrup and/or sugar, caramel color, phosphoric acid, caffeine, citric acid and natural flavorings.
Re: Printing From trn?
Author: Sridhar Venkataraman
Date: Tue, 06 Oct 1992 18:20
Date: Tue, 06 Oct 1992 18:20
62 lines
2868 bytes
2868 bytes
barr@pop.psu.edu (David Barr) writes on news.software.readers: )westes@netcom.com (Will Estes) writes: ) )>So far so good. But your solution leads me to my next question: how do I )>configure trn so that it uses csh instead of sh as the environment in which to )>execute the piped command? ) )did you try: ) )setenv SHELL /bin/csh ) )? (This is all rather clearly documented in the man page) Yes, I sent the same reply by mail and I tried the same thing myself. Sigh. It didn't work! I read through the whole manpage. Nope. No clues why. The some "echo $PATH" and "echo $path" inside .cshrc explained what was happening. Here is what my .cshrc looks like: (Pardon any lousy scripting and also please no csh flames. I know, I know csh is lousy. :) Then I realised that *rn takes only env. variables and passes the same to any process it spawns. So passing of csh or tcsh variables doesn't happen. Hence you need to manipulate PATH using env. vars *only*. This one is after I made corrections. Previously it had oldpath as a shell variable and was tacked on to $path. if ( $?OLDPATH ) then #For debugging echo "Path already set" else setenv OLDPATH `echo $PATH | sed -e 's/\.//g'` endif set mypath= (~sridhar/bin ~sridhar/scripts /etc /usr/lib ) set localpath= (/usr/new /usr/new/X11 /usr/gnu/bin) if ( $host == enuxhb || $host == enuxha ) then set harrispath= (~csgsa/bin /usr/tmp/threads) set path= ( $mypath $localpath $harrispath ) setenv PATH $PATH\:$OLDPATH unset mypath localpath harrispath else set path= ( $mypath $localpath) setenv PATH $PATH\:$OLDPATH unset mypath localpath endif To answer any possible questions: Setting of PATH affects rsh etc. hence it is in .cshrc. I need to set my path explicitly bcos not every sysadmin is aware of security concerns around . in PATH. )--Dave In case I messed up, corrections are appreciated! I would guess that the problem I faced might have happened to the original poster. Sridhar.
Re: Printing From trn?
Author: Will Estes
Date: Tue, 06 Oct 1992 18:54
Date: Tue, 06 Oct 1992 18:54
34 lines
1761 bytes
1761 bytes
barr@pop.psu.edu (David Barr) writes: >In article <1992Oct5.234128.17631@netcom.com> westes@netcom.com (Will Estes) writes: >>barr@pop.psu.edu (David Barr) writes: >> >>>In article <1992Oct4.213425.3041@netcom.com> westes@netcom.com (Will Estes) writes: >>>>How does one print an article from trn? Where do you set the print >>>>string? >> >>>| lpr >> >>So far so good. But your solution leads me to my next question: how do I configure >>trn so that it uses csh instead of sh as the environment in which to >>execute the piped command? >did you try: >setenv SHELL /bin/csh >? (This is all rather clearly documented in the man page) Yes, I execute setenv SHELL /bin/csh from my .cshrc, but it doesn't take hold. trn is still using /bin/sh. >Why do you need csh in this case, anyway? Because I have an alias that prints to a postscript printer like this: (cat .ps-prefix; cat ) | print -h -PNEC For misc. reasons, I would rather have that as an alias than a script. Thanks, Will
Re: Printing From trn?
Author: Wayne Davison
Date: Wed, 07 Oct 1992 20:39
Date: Wed, 07 Oct 1992 20:39
52 lines
2307 bytes
2307 bytes
westes@netcom.com (Will Estes) wrote:
> how do I configure trn so that it uses csh instead of sh as the
> environment in which to execute the piped command?
Excerpts from the trn manpage:
# | command
# Shorthand for "s | command".
# s destination
# Save to a filename or pipe using sh. If the first
^^^^^^^^
# S destination
# Save to a filename or pipe using a preferred shell,
# such as csh. Which shell is used depends first on
# what you have the environment variable SHELL set to,
So by extrapolation, you'd do a:
S | progname
to use the current setting of your SHELL variable. Alternately, you could
macro | to "S|" by putting the following line into your .rnmac file:
| %(%m=a?S|:|)
though you might just want to macro some other character to the entire
print command:
~ %(%m=a?S|lpr^M:~)
(both of these are untested, but they should work). Also, check out the
PIPESAVER environment variable:
# PIPESAVER (%)
# The shell command to execute in order to accomplish
# a save to a pipe ("s | command" or "w | command").
# The command typed by the user is substituted in as
# %b.
#
# Default: %(%B=^0$?<%A:tail +%Bc %A |) %b
#
# Explanation: if %B is 0, the command is "<%A %b",
which could be modified to execute csh from the spawned sh. Perhaps:
%(%B=^0$?/bin/csh <%A:tail +%Bc %A | /bin/csh) %b
would work.
--
Wayne Davison
davison@borland.com
Re: Printing From trn?
Author: Will Estes
Date: Sat, 10 Oct 1992 01:04
Date: Sat, 10 Oct 1992 01:04
61 lines
2764 bytes
2764 bytes
davison@borland.com (Wayne Davison) writes:
>westes@netcom.com (Will Estes) wrote:
>> how do I configure trn so that it uses csh instead of sh as the
>> environment in which to execute the piped command?
>Excerpts from the trn manpage:
># | command
># Shorthand for "s | command".
># s destination
># Save to a filename or pipe using sh. If the first
> ^^^^^^^^
># S destination
># Save to a filename or pipe using a preferred shell,
># such as csh. Which shell is used depends first on
># what you have the environment variable SHELL set to,
>So by extrapolation, you'd do a:
> S | progname
>to use the current setting of your SHELL variable. Alternately, you could
>macro | to "S|" by putting the following line into your .rnmac file:
>| %(%m=a?S|:|)
>though you might just want to macro some other character to the entire
>print command:
>~ %(%m=a?S|lpr^M:~)
>(both of these are untested, but they should work). Also, check out the
>PIPESAVER environment variable:
># PIPESAVER (%)
># The shell command to execute in order to accomplish
># a save to a pipe ("s | command" or "w | command").
># The command typed by the user is substituted in as
># %b.
>#
># Default: %(%B=^0$?<%A:tail +%Bc %A |) %b
>#
># Explanation: if %B is 0, the command is "<%A %b",
>which could be modified to execute csh from the spawned sh. Perhaps:
>%(%B=^0$?/bin/csh <%A:tail +%Bc %A | /bin/csh) %b
>would work.
And as you'll find out if you try any of the above: the aliases for the
replacement shell won't be effective (in csh's case, .cshrc doesn't
run). So it looks like I'm stuck writing a script.
Hmm, does anyone vote for just adding an option to trn to print the
current article using some command that you can specify in a settings
file?
Will
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads