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 tarball for details.
14 char* FAST_FUNC regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags)
16 int ret = regcomp(preg, regex, cflags);
18 int errmsgsz = regerror(ret, preg, NULL, 0);
19 char *errmsg = xmalloc(errmsgsz);
20 regerror(ret, preg, errmsg, errmsgsz);
26 void FAST_FUNC xregcomp(regex_t *preg, const char *regex, int cflags)
28 char *errmsg = regcomp_or_errmsg(preg, regex, cflags);
30 bb_error_msg_and_die("bad regex '%s': %s", regex, errmsg);