1 /* xregex.c - regex functions with error messages
5 Copyright (C) 2001 University of Southern California
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
21 #include "libbb/libbb.h"
23 static void print_regcomp_err(const regex_t
*preg
, int err
);
25 int xregcomp(regex_t
*preg
, const char *regex
, int cflags
)
28 err
= regcomp(preg
, regex
, cflags
);
30 print_regcomp_err(preg
, err
);
36 static void print_regcomp_err(const regex_t
*preg
, int err
)
41 size
= regerror(err
, preg
, 0, 0);
42 error
= xcalloc(1, size
);
43 regerror(err
, preg
, error
, size
);
45 opkg_msg(ERROR
, "Internal error compiling regex: %s.", error
);