Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Date: Mon, 7 May 2001 15:25:14 +0200
From: Corinna Vinschen <cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Regular expressions compile call.
Message-ID: <20010507152514.B24200@cygbert.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <OFAF7FC14E.8BB28340-ONC1256A45.00445D13@stoltoffshore.no>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
In-Reply-To: <OFAF7FC14E.8BB28340-ONC1256A45.00445D13@stoltoffshore.no>; from oddvard.myrnes@stoltoffshore.no on Mon, May 07, 2001 at 02:33:09PM +0200

On Mon, May 07, 2001 at 02:33:09PM +0200, oddvard.myrnes@stoltoffshore.no wrote:
> I am working on a cygwin port from Linux. Straight forward, but one thing
> puzzels me. Why is the regcomp call diffrent. I have to use this pice of
> code to make it work on both platforms:
> 
> #ifdef cygwin
>     regex_t *re;
> #else
>     regex_t a, *re;
>     re = &a;
> #endif
> 
>     i = regcomp(re, filter, REG_EXTENDED);
> 
> If I use a preallocated buffer in Cygwin i get an i = 269335288 = random.
> Program gets unstable after the call. If I use a pointer it works.
> 
> On the linux box (Suse 7.0) I get a segmentation violation trying to run
> with a pointer. Will run fine with a preallocated buffer. They are oposite
> in behavior. What do I miss?

Cygwin itself contains a very old implementation of regex which
isn't compatible with any standard I'm aware of.

But the Cygwin net distro contains two packages regex-4.4 and
pcre-3.4 which provide libraries which contain POSIX regex APIs.
If you have installed them (recommended), just include the
correct headers

	regex-4.4:	regex.h
	pcre-3.4:	pcreposix.h 

and link with

	regex-4.4:	-lregex
	pcre-3.4:	-lpcre -lpcreposix

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

