Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <5.0.2.1.0.20010204234757.009f0470@pop3.martysparadox.com> X-Sender: marty%martysparadox DOT com AT pop3 DOT martysparadox DOT com (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Sun, 04 Feb 2001 23:56:29 -0600 To: cygwin AT cygwin DOT com From: Marty Subject: Regex question (is it broken?) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed I installed Cygwin a couple of weeks ago, and I notice that the regex functionality seems broken. Attached is a test program I cobbled together from various places, just so I could get a handle on using regex properly. However, while this program compiles properly, it does not execute correctly on either of two machines I've tried Cygwin on (WinNT box and a Win98 box), while compiling this on a Sun/Solaris/etc. unix machine seems to make it work just fine. I've searched the archives, etc., and cannot find info on this issue. What's going on?? Marty Output on Unix box using native gcc: 2Status = 1 NOT A MATCH MATCH!! Output on Windows machine using Cygwin complete install (via the setup program): 1Status = 1 NOT A MATCH 1Status = 1 NOT A MATCH The test program (compile using "gcc" with no extra options): #include #include #include /* * Match string against the extended regular expression in * pattern, treating errors as no match. * * return 1 for match, 0 for no match */ int match(const char *string, char *pattern) { int status; regex_t re; if (status = regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0) { printf("1Status = %d\n", status); return(0); /* report error */ } status = regexec(&re, string, (size_t) 0, NULL, 0); regfree(&re); if (status != 0) { printf("2Status = %d\n", status); return(0); /* report error */ } return(1); } int main(int argc, char **argv) { if (match("a", "b")) { printf("MATCH!!\a\n"); } else { printf("NOT A MATCH\n\n"); } if (match("a", "a")) { printf("MATCH!!\a\n"); } else { printf("NOT A MATCH\n\n"); } return 0; } -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple