grepjar and libregex
Ranjit Mathew
rmathew@hotmail.com
Sun Jan 26 03:35:00 GMT 2003
Tom Tromey wrote:
>> Ranjit> The "grepjar" tool in "fastjar" needs the regex
> Ranjit> functions, which seem to be there within glibc on Linux
> Ranjit> but are not a part of the standard C library on Win32.
>> Can't we just use the regex in libiberty? We already link grepjar
> against libiberty. Why doesn't that pick up the regex functions?
Good catch!
To use libiberty, one must include "xregex.h" instead of "regex.h".
libiberty defines regexfoo( ) functions as xregexfoo( ) in order
to not clash with the corresponding regex functions provided by
libc - "xregex.h" then defines a regexfoo( ) macro that uses
xregexfoo( ), so that the change is transparent to the programmer.
If fastjar is to remain within the GCC tree, the following patch
(tested with 3.3 for mingw32) proposes to make this change:
---------------------------------- 8< ----------------------------------
2003年01月26日 Ranjit Mathew <rmathew@hotmail.com>
* jargrep.c: Include xregex.h from libiberty instead of
system regex.h for better portability.
--- jargrep.c 2003年01月26日 08:10:53.000000000 +0530
+++ jargrep.c 2003年01月26日 08:28:11.000000000 +0530
@@ -106,5 +106,4 @@
#include <stdio.h>
#include <unistd.h>
-#include <regex.h>
#include <errno.h>
#include <string.h>
@@ -116,4 +115,7 @@
#include <stdlib.h>
#endif
+
+#include "xregex.h"
+
#include "jargrep.h"
#include "jartool.h"
---------------------------------- 8< ----------------------------------
Sincerely Yours,
Ranjit.
--
Ranjit Mathew Email: rmathew AT hotmail DOT com
Bangalore,
INDIA. Web: http://ranjitmathew.tripod.com/
More information about the Java
mailing list