summaryrefslogtreecommitdiff
path: root/libbb/xregcomp.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-12-21 00:22:03 +0000
committerDenis Vlasenko2006-12-21 00:22:03 +0000
commit3f3190e34c5d39986fae0ec03f37cf5509dd9c93 (patch)
tree15ecde8cea8fcd622729c9210abfbd5ae2fef5ce /libbb/xregcomp.c
parent9a7cef930f7e299c0e5d9d1ddeb3f95db6749eb7 (diff)
downloadbusybox-3f3190e34c5d39986fae0ec03f37cf5509dd9c93.zip
busybox-3f3190e34c5d39986fae0ec03f37cf5509dd9c93.tar.gz
less: total cleanup and bugfix.
Doesn't die horribly on binary files anymore. In fact, they _100%_ work now. Control chars are in reverse video, including DEL and that idiocy of VT-10x, Meta-ESC [inventor of which should be prohibited from reproducing]. Regex search is fixed also. When you specify search ('/' key), control chars turn into dots (unhighlighted), and found occurrences highlighted instead. This is reversible. Memory management fixed (was leaky as hell) and optimized. Linewrapping fixed and thoroughly tested. Max buffer size made configurable. ~ 600 bytes saved.
Diffstat (limited to 'libbb/xregcomp.c')
-rw-r--r--libbb/xregcomp.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libbb/xregcomp.c b/libbb/xregcomp.c
index 4bcb9ae..6e9a29f 100644
--- a/libbb/xregcomp.c
+++ b/libbb/xregcomp.c
@@ -8,16 +8,13 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include <stdio.h>
#include "libbb.h"
#include "xregex.h"
-
-
void xregcomp(regex_t *preg, const char *regex, int cflags)
{
- int ret;
- if ((ret = regcomp(preg, regex, cflags)) != 0) {
+ int ret = regcomp(preg, regex, cflags);
+ if (ret) {
int errmsgsz = regerror(ret, preg, NULL, 0);
char *errmsg = xmalloc(errmsgsz);
regerror(ret, preg, errmsg, errmsgsz);