🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
2 messages
2 total messages Started by Destiny Software Mon, 18 Mar 1996 00:00
Why "cat cmd | trn" works but "trn < cmd" doesn't?
#5764
Author: Destiny Software
Date: Mon, 18 Mar 1996 00:00
38 lines
1731 bytes
Hi,
I'm trying to setup an automated news grabber, and what I did was putting 
some trn commands in a texxt file and pipe it to trn.  The text file 
looks something like:

  g news.software.nntp
  +/pipe/a:s found.article
  etc...

It should instruct trn to goto news.software.nntp group and search for 
articles containing the word pipe, and save them in 
~/News/found.article.  However, I found out that "cat cmd | trn" works 
but "trn < cmd" doesn't.  As far as I can tell, they should accomplish 
the same thing, and the "cat..." version just has a little more 
overhead.  In the "trn < cmd" case, it appear that the first character in 
"cmd" is being sent to trn in an endless loop.  I've tried:

   trn < cmd > trn.output &

and wait for a few seconds, and then kill the process.  The contents of 
trn.output looks something like this:

  [the first few lines are regular trn output]
  ...stat. about subscribed groups...
  ...read now?[+ynq]
  g
  g
  g
  g
  ...

And the 'g' lines continues...  When I tried to load trn.output into vi 
or pico, they complained about long lines.  What's going on?

recon


Re: Why "cat cmd | trn" works but "trn < cmd" doesn't?
#5886
Author: James Brister
Date: Thu, 21 Mar 1996 00:00
22 lines
1416 bytes
Destiny Software (a04029@giant.mindlink.net) wrote:

: It should instruct trn to goto news.software.nntp group and search for 
: articles containing the word pipe, and save them in 
: ~/News/found.article.  However, I found out that "cat cmd | trn" works 
: but "trn < cmd" doesn't.  

trn is probably using select(2) on fd #0. When you do '<' that fd is
hooked to a file and selecting such a file descriptor always returns
true immediately. fd0 in the cat case is a pipe, which is selectable.
trn probably wants to select between fd0 and the fd hooked to nntpd, and
by redirecting from a file that breaks.

Expect is the application you probably should look into driving tin for
you.

James
--
James Brister                                              brister@vix.com
The Internet Software Consortium

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