[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev lynx2.8.4dev.9

From: pg
Subject: Re: lynx-dev lynx2.8.4dev.9
Date: Fri, 1 Sep 2000 14:17:33 -0600 (MDT)

In a recent note, Thomas E. Dickey said:

> Date: Fri, 1 Sep 2000 15:52:32 -0400 (EDT)
> On Fri, 1 Sep 2000 address@hidden wrote:
> > I see in Lynx.trace:
> > 
> >     cat /tmp/pg-volatile/L4179-8025TMP.gif|( set -x; ls -alrt $TMPDIR; xv - 
> > & sleep 22 ) 2>&1
> > 
> > And it was a fortunate accident that I put the parentheses around my
> > .mailcap line trying to understand what was happening.  Otherwise
> > the "cat" would have piped into "set" rather than into "xv".
> > perhaps Lynx should supply the parentheses.  I believe the syntax
> > is the same for both csh and POSIX shell.
> perhaps I could revisit that and make it do a pipe (we don't use pipes
> in many places, and in case the logic is rather ugly ;-)
Do you mean popen()?  I find a few of those with grep.  If not
popen(), you need to:

    fork(); open(); dup2(); close(); exec(); waitpid();

I'll grant that's ugly.  Especially when you forget to bypass
the close() if it turned out to be dup2(0,0).  :-)

> > As long as it's ifdef'd for UNIX, redirection would suffice and be
> > one fork cheaper than piping.
> you mean something like
>       ( command ) <input

> I hadn't thought about that.  I've been burned with some shells that
> won't work properly if I redirect to an arbitrary command, and use

I should have enough experience by now not to be surprised that
some shells place more stringent restrictions on "<" than on "|".

> 'cat' if there's a question about it.  In either case, there's no
> recovery if the command contains an unbalanced parenthesis...
That's an error even if you don't add enclosing parentheses.
"(" and ")" may be more expensive than "{" and "}", but they're
a lot safer syntactically.

-- gil

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]