regex fix for cygwin

Alexander Varakin avarakin00 at hotmail.com
Sun Feb 24 04:00:49 UTC 2002


Hi,

I fixed the problem with regex on cygwin.
The reason of the problem is that definition of regexec() in regex.c is
disabled using  #if 0 (why?) , and It looks like the cygwin's implementation
is not
right (compatible?), so all this regex business fails.
I fixed the problem by replacing "#if 0" by #ifdef  __CYGWIN__, this is the
safest approach, it shouldn't break any other platforms.
But the better fix would be to remove those "#if 0" completely, this will
make mc's regex code indpendent of system libary, but this may be risky.
Now mc's find-file works, and viewer doesn't use "nm" for opening all files.

Alex



Index: eregex.h
===================================================================
RCS file: /cvs/gnome/mc/src/eregex.h,v
retrieving revision 1.2
diff -c -r1.2 eregex.h
*** eregex.h 2000/08/22 22:50:14 1.2
--- eregex.h 2002/02/24 03:52:49
***************
*** 347,353 ****
  /* [[[end pattern_buffer]]] */
  };

! #if 0
  typedef struct re_pattern_buffer regex_t;
  #endif

--- 347,353 ----
  /* [[[end pattern_buffer]]] */
  };

! #ifdef __CYGWIN__
  typedef struct re_pattern_buffer regex_t;
  #endif

***************
*** 373,379 ****
  #define RE_NREGS 30
  #endif

! #if 0
  /* POSIX specification for registers.  Aside from the different names than
     `re_registers', POSIX uses an array of structures, instead of a
     structure of arrays.  */
--- 373,379 ----
  #define RE_NREGS 30
  #endif

! #ifdef __CYGWIN__
  /* POSIX specification for registers.  Aside from the different names than
     `re_registers', POSIX uses an array of structures, instead of a
     structure of arrays.  */
***************
*** 475,481 ****
  extern int re_exec _RE_ARGS ((const char *));
  #endif

! #if 0
  /* POSIX compatibility.  */
  extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int
cflags));
  extern int regexec
--- 475,481 ----
  extern int re_exec _RE_ARGS ((const char *));
  #endif

! #ifdef __CYGWIN__
  /* POSIX compatibility.  */
  extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int
cflags));
  extern int regexec




Index: regex.c
===================================================================
RCS file: /cvs/gnome/mc/src/regex.c,v
retrieving revision 1.7
diff -c -r1.7 regex.c
*** regex.c 2001/08/19 16:18:40 1.7
--- regex.c 2002/02/24 03:53:12
***************
*** 5176,5182 ****
  

  /* POSIX.2 functions.  Don't define these for Emacs.  */

! #if 0

  /* regcomp takes a regular expression as a string and compiles it.

--- 5176,5182 ----
  

  /* POSIX.2 functions.  Don't define these for Emacs.  */

! #ifdef __CYGWIN__

  /* regcomp takes a regular expression as a string and compiles it.






More information about the mc-devel mailing list