regex.h, regcomp and regexec? Standard?

Robert Frank frank at ifi.unibas.ch
Tue Apr 14 10:09:26 GMT 1998


> > I have used <regex.h>, regcomp and regexec. Are these available on all
> > systems?
>
> unfortunately not, but most will have them.
>
> What we should do is either:
>
> 1) include one of the GPLd regex implementations with Samba and use
> that on systems that don't have it.
> 2) use one of the existing wildcard handling routines that are already
> in Samba.
>
> The latter is probably preferable. is mask_match() sufficient for your
> needs?

I'd like to inject a different idea:
In a larger project we did over here, I solved this problem as follows:

- All programming was done in accordance with posix,
  as far as the items were defined in posix.
- all posix procedures used were listed and placed in
  posix.h and posix.c files, which contained mostly comments.
  The posix.h also included all posix headers.
- all machines which didn't have a posix implementation,
  or used variations thereof, had their own .h anc .c
- upon calling make, make would determine the last architecture
  used. If the last and current differed, it would isue a
  make clean, then relink the .h and .c from the appropriate
  architecture to system.h and system.c, then make.

This way we could keep all system dependent stuff out of the code (no  
#ifdef ...) and porting to a new architecture was quite easy, as we could  
normally find something close to start with, then modify the .h and .c  
files.

I do realize that this would be a huge change, but ...
Would I do it? Yep, I would. But not within two weeks.

- Robert
-------------------------------------
Institut fuer Informatik           tel  +41 (0)61 321 99 67
Universitaet Basel                 fax. +41 (0)61 321 99 15
Robert Frank
Mittlere Strasse 142    rfc822: frank at ifi.unibas.ch (NeXT,MIME mail ok)
CH-4056 Basel           (remove any no_spam_ from my return address)
Switzerland


More information about the samba-technical mailing list