diff options
author | Karel Zak | 2012-06-05 14:19:13 +0200 |
---|---|---|
committer | Karel Zak | 2012-06-05 14:19:13 +0200 |
commit | eecbb2cfeebd01244f07c49f49028089052526f3 (patch) | |
tree | cd581803fa695cde48ac3d8c4ff7d5b9a1c05edd /text-utils | |
parent | more: remove a meaningless test (diff) | |
download | kernel-qcow2-util-linux-eecbb2cfeebd01244f07c49f49028089052526f3.tar.gz kernel-qcow2-util-linux-eecbb2cfeebd01244f07c49f49028089052526f3.tar.xz kernel-qcow2-util-linux-eecbb2cfeebd01244f07c49f49028089052526f3.zip |
more: fix regex error messages printing
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils')
-rw-r--r-- | text-utils/more.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/text-utils/more.c b/text-utils/more.c index ac05a658a..d86d66420 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -127,6 +127,7 @@ void prepare_line_buffer(void); #define INIT_BUF 80 #define SHELL_LINE 1000 #define COMMAND_BUF 200 +#define REGERR_BUF NUM_COLUMNS struct termios otty, savetty0; long file_pos, file_size; @@ -1583,13 +1584,13 @@ void search(char buf[], FILE *file, register int n) register long line3 = startline; register int lncount; int saveln, rv, rc; - char *s; regex_t re; context.line = saveln = Currline; context.chrctr = startline; lncount = 0; - if (rc = regcomp (&re, buf, REG_NOSUB) != 0) { + if ((rc = regcomp (&re, buf, REG_NOSUB)) != 0) { + char s[REGERR_BUF]; regerror (rc, &re, s, sizeof s); more_error (s); } |