On Sat, Nov 14, 2015 at 2:22 AM, Alessandro DE LAURENZIS
<just22....@gmail.com> wrote:
> Dear misc@ readers,
>
> After the recent switch to less(1) from Illumos, I noticed that the
> --RAW-CONTROL-CHARS option, although documented, isn't supported
> anymore:
>
> [....................snip....................]
> ┌──[just22@poseidon]-[0]-[✓]-[~]
> └─────› colorls -Gla | less --RAW-CONTROL-CHARS
> There is no RAW-CONTROL-CHARS option ("less --help" for help)
> [....................snip....................]
>
> Instead, "-R" is still accepted; but the behavior is still confusing,
> since it seems that ANSI color escape sequences are output in raw form
> by default; i.e. both:
>
> [....................snip....................]
> ┌──[just22@poseidon]-[0]-[✓]-[~]
> └─────› colorls -G | less
> [....................snip....................]
>
> and:
>
> [....................snip....................]
> ┌──[just22@poseidon]-[0]-[✓]-[~]
> └─────› colorls -G | less -R
> [....................snip....................]
>
> give the exact same result. Should we remove the "-R" option completely
> (from the man page too) or am I missing something obvious?

Nope.  If you compare the results of using "less -r" vs "less -R" on a
text file that has a bare carriage-return in the middle of a line of
text, you'll see that the former lets the CR reposition the following
text at the beginning of the line, while the latter displays the CR as
"^M" in bold (if the display supports that).  So -r vs -R is still
valid.

What broke was the interpretation of long-style arguments with
capitals after the first character.  This was an error in one of the
cleanup passes.  The first change in the diff below fixes it for me
(isupper-->islower).

While where, eliminate some pointless tests: tolower() works on all
characters, not just uppercase letters.

oks?

Index: main.c
===================================================================
RCS file: /data/src/openbsd/src/usr.bin/less/main.c,v
retrieving revision 1.29
diff -u -p -r1.29 main.c
--- main.c      13 Nov 2015 16:48:48 -0000      1.29
+++ main.c      14 Nov 2015 11:17:07 -0000
@@ -350,13 +350,12 @@ sprefix(char *ps, char *s, int uppercase
        for (; *s != '\0';  s++, ps++) {
                c = *ps;
                if (uppercase) {
-                       if (len == 0 && isupper(c))
+                       if (len == 0 && islower(c))
                                return (-1);
-                       if (isupper(c))
-                               c = tolower(c);
+                       c = tolower(c);
                }
                sc = *s;
-               if (len > 0 && isupper(sc))
+               if (len > 0)
                        sc = tolower(sc);
                if (c != sc)
                        break;

Reply via email to