Subject: Re: pthread + pkgsrc proposal
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.org>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-pkg
Date: 12/06/2004 09:19:05
On Thu, Nov 25, 2004 at 05:04:45PM -0500, Greg A. Woods wrote:
> Ask a NetBSD pthreads expert for the right answer but in the mean time
> it would at least be better to do something like this:
> 
> .if ${OPSYS} == "NetBSD"
> 
> # Note that __NetBSD_Version__ is only in 1.3.3 and -current >= 1.3C
> #
> 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.

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.

Regards,
Alistair