morpheus-base

morpheus base system
git clone git://git.2f30.org/morpheus-base
Log | Files | Refs

eregcomp.c (490B)


      1 #include <regex.h>
      2 #include <stdio.h>
      3 #include <sys/types.h>
      4 
      5 #include "../util.h"
      6 
      7 int
      8 enregcomp(int status, regex_t *preg, const char *regex, int cflags)
      9 {
     10     char errbuf[BUFSIZ] = "";
     11     int r;
     12 
     13     if((r = regcomp(preg, regex, cflags)) == 0)
     14         return r;
     15 
     16     regerror(r, preg, errbuf, sizeof(errbuf));
     17     enprintf(status, "invalid regex: %s\n", errbuf);
     18     return r;
     19 }
     20 
     21 int
     22 eregcomp(regex_t *preg, const char *regex, int cflags)
     23 {
     24 	return enregcomp(1, preg, regex, cflags);
     25 }