Last change
on this file since 2859 was 2725, checked in by Bruno Cornec, 14 years ago |
- Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
|
File size:
769 bytes
|
Rev | Line | |
---|
[821] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
| 3 | * Utility routines.
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) many different people.
|
---|
| 6 | * If you wrote this, please acknowledge your work.
|
---|
| 7 | *
|
---|
[2725] | 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[821] | 9 | */
|
---|
| 10 |
|
---|
| 11 | #include "libbb.h"
|
---|
| 12 | #include "xregex.h"
|
---|
| 13 |
|
---|
[2725] | 14 | char* FAST_FUNC regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags)
|
---|
[821] | 15 | {
|
---|
[1765] | 16 | int ret = regcomp(preg, regex, cflags);
|
---|
| 17 | if (ret) {
|
---|
[821] | 18 | int errmsgsz = regerror(ret, preg, NULL, 0);
|
---|
| 19 | char *errmsg = xmalloc(errmsgsz);
|
---|
| 20 | regerror(ret, preg, errmsg, errmsgsz);
|
---|
[1765] | 21 | return errmsg;
|
---|
| 22 | }
|
---|
| 23 | return NULL;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
[2725] | 26 | void FAST_FUNC xregcomp(regex_t *preg, const char *regex, int cflags)
|
---|
[1765] | 27 | {
|
---|
| 28 | char *errmsg = regcomp_or_errmsg(preg, regex, cflags);
|
---|
| 29 | if (errmsg) {
|
---|
[2725] | 30 | bb_error_msg_and_die("bad regex '%s': %s", regex, errmsg);
|
---|
[821] | 31 | }
|
---|
| 32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.