Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- text-utils/more.c | 72 +++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/text-utils/more.c b/text-utils/more.c index 75426e9..15ebb91 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -997,47 +997,45 @@ int get_line(register FILE *f, int *length) } else if (c == EOF) { *length = p - Line; return (column); - } else { + } #ifdef HAVE_WIDECHAR - if (fold_opt && MB_CUR_MAX > 1) { - memset(mbc, '\0', MB_LEN_MAX); - mbc_pos = 0; - mbc[mbc_pos++] = c; - state_bak = state; - - mblength = mbrtowc(&wc, mbc, mbc_pos, &state); - /* The value of mblength is always less than 2 here. */ - switch (mblength) { - case (size_t)-2: - p--; - file_pos_bak = Ftell(f) - 1; - state = state_bak; - use_mbc_buffer_flag = 1; - break; - - case (size_t)-1: - state = state_bak; - column++; - break; - - default: - wc_width = wcwidth(wc); - if (wc_width > 0) - column += wc_width; - } - } else + else if (fold_opt && MB_CUR_MAX > 1) { + memset(mbc, '\0', MB_LEN_MAX); + mbc_pos = 0; + mbc[mbc_pos++] = c; + state_bak = state; + + mblength = mbrtowc(&wc, mbc, mbc_pos, &state); + /* The value of mblength is always less than 2 here. */ + switch (mblength) { + case (size_t)-2: + p--; + file_pos_bak = Ftell(f) - 1; + state = state_bak; + use_mbc_buffer_flag = 1; + break; + + case (size_t)-1: + state = state_bak; + column++; + break; + + default: + wc_width = wcwidth(wc); + if (wc_width > 0) + column += wc_width; + } + } #endif /* HAVE_WIDECHAR */ - { - if (isprint(c)) - column++; - else { - column -= 4; - if (column < 0) - column = 0; - } + else { + if (isprint(c)) + column++; + else { + column -= 4; + if (column < 0) + column = 0; } } - if (column >= Mcol && fold_opt) break; #ifdef HAVE_WIDECHAR -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html