1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work.
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13 char* FAST_FUNC regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags)
15 int ret = regcomp(preg, regex, cflags);
17 int errmsgsz = regerror(ret, preg, NULL, 0);
18 char *errmsg = xmalloc(errmsgsz);
19 regerror(ret, preg, errmsg, errmsgsz);
25 void FAST_FUNC xregcomp(regex_t *preg, const char *regex, int cflags)
27 char *errmsg = regcomp_or_errmsg(preg, regex, cflags);
29 bb_error_msg_and_die("bad regex '%s': %s", regex, errmsg);