Subject: Re: pthread + pkgsrc proposal
To: Alistair Crooks <>
From: Greg A. Woods <>
List: tech-pkg
Date: 12/06/2004 14:22:37
[ On Monday, December 6, 2004 at 09:19:05 (+0000), Alistair Crooks wrote: ]
> Subject: Re: pthread + pkgsrc proposal
> > NETBSD_VERSION != grep __NetBSD_Version__ /usr/include/sys/param.h | \
> > 			awk 'BEGIN{v=0} $$1 == "\#define" {v=$$3} END{print v}'
> Regardless of the merits or demerits of your case, I always thought
> that a grep | awk pipeline was superfluous - just use awk itself, it
> has perfectly good regular expressions within it.

Oi!  How right you are!

For some reason my instinct is to baulk at using $0, implicitly or
explicitly, for pattern matching in my awk fumbles.

I also have a strong aversion to using regular expressions to do plain
string matching.  In my source tree I actually used "fgrep", but I
zapped the "f" when I posted that suggestion for reasons I don't quite
recall.  :-)

Even together those little quirks are no excuse for using two processes

> In fact, I'd write the above as
> NETBSD_VERSION!= awk '/^#define[ \t]*__NetBSD_Version__/ { print $$3 }' /usr/include/sys/param.h
> and then you don't have to worry about the false match in the comment.

That looks _much_ better.  Thanks very much!

						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <>
Planix, Inc. <>          Secrets of the Weird <>