This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: igawk problem


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@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]