delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/08/18/14:33:01

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Wed, 18 Aug 2004 14:32:26 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Hans Horn <hannes AT 2horns DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: igawk problem
In-Reply-To: <cg06d5$rn2$1@sea.gmane.org>
Message-ID: <Pine.GSO.4.61.0408181425240.1878@slinky.cs.nyu.edu>
References: <cfj317$os8$1 AT sea DOT gmane DOT org> <Pine DOT GSO DOT 4 DOT 58 DOT 0408132323001 DOT 594 AT slinky DOT cs DOT nyu DOT edu> <cfluvo$hfj$1 AT sea DOT gmane DOT org> <Pine DOT GSO DOT 4 DOT 61 DOT 0408161959540 DOT 6952 AT slinky DOT cs DOT nyu DOT edu> <cg06d5$rn2$1 AT sea DOT gmane DOT org>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Wed, 18 Aug 2004, Hans Horn wrote:

> Hi Igor,
> 
> thanks for all your insightful advice.
> 
> However, none of your suggestions work ootb.

Hans,

None of the suggestions were tested.  Sorry for missing the "--" in the 
arg list -- I should have been more careful.

> This one doesn't do anything:
> 
> > tmpname=`mktemp`
> > gawk -- "$expand_prog" /dev/stdin <<EOF >$tmpname
> > $program
> > EOF
> > eval gawk $opts -- -f $tmpname '"$@"' \
> >  && rm -f $tmpname
> 
> If I understand the gawk man page right, -- is used to indicate the end of
> the gawk arg list.
> So the order of the args must be changed to
> 
> gawk $opts -f $tmpname -- '"$@"' && rm -f $tmpname
> 
> This happens to work - even under aix!

Great.  As I remarked in a later e-mail to Yitzchak, using xargs would be 
equivalent to calling the command from the shell in terms of handling long 
arguments, anyway, so strike that "solution".  The "mktemp" ones seems 
best for all intents and purposes.  If you're *sure* that the script won't 
be used with stdin, you could try the (suitably modified) third solution, 
i.e.,

gawk -- "$expand_prog" /dev/stdin <<EOF | eval gawk $opts -f- -- '"$@"'
$program
EOF

(that pesky "--" thing again).

> The next one gives "xargs: argument line too long" :
> 
> > gawk -- "$expand_prog" /dev/stdin <<EOF | eval xargs -0i gawk $opts
> > -- {} '"$@"' $program
> > EOF
> 
> You suggested in one of your earlier replies to submit this as a fix
> upstream. How does one do that?

Well, hopefully, it'll be enough to have posted the solution here, so that 
the gawk maintainer (Corinna) picks it up and, if she likes it, pushes it 
upstream...

> Would you mind doing it instead? After all, you were really the one that
> came up with a solution.

We'll see what Corinna says.  The above solution does introduce a 
dependency on mktemp that the gawk maintainers may not wish...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019