Initial push
[termux-packages] / packages / coreutils / ls_colors_auto.patch
CommitLineData
59f0d218
FF
1diff -u -r ../coreutils-8.22/src/ls.c ./src/ls.c
2--- ../coreutils-8.22/src/ls.c 2013-12-04 15:48:30.000000000 +0100
3+++ ./src/ls.c 2014-02-14 16:11:48.000000000 +0100
4@@ -1641,6 +1641,15 @@
5 }
6 }
7
8+ print_with_color = isatty (STDOUT_FILENO);
9+ if (print_with_color)
10+ {
11+ /* Don't use TAB characters in output. Some terminal
12+ emulators can't handle the combination of tabs and
13+ color codes on the same line. */
14+ tabsize = 0;
15+ }
16+
17 while (true)
18 {
19 int oi = -1;
20@@ -1889,25 +1898,7 @@
21
22 case COLOR_OPTION:
23 {
24- int i;
25- if (optarg)
26- i = XARGMATCH ("--color", optarg, color_args, color_types);
27- else
28- /* Using --color with no argument is equivalent to using
29- --color=always. */
30- i = color_always;
31-
32- print_with_color = (i == color_always
33- || (i == color_if_tty
34- && isatty (STDOUT_FILENO)));
35-
36- if (print_with_color)
37- {
38- /* Don't use TAB characters in output. Some terminal
39- emulators can't handle the combination of tabs and
40- color codes on the same line. */
41- tabsize = 0;
42- }
43+ // Do nothing - color has been patched to color_if_tty.
44 break;
45 }
46
47@@ -2098,11 +2089,13 @@
48 }
49 }
50
51+#ifndef __ANDROID__
52 /* Note we leave %5b etc. alone so user widths/flags are honored. */
53 if (strstr (long_time_format[0], "%b")
54 || strstr (long_time_format[1], "%b"))
55 if (!abmon_init ())
56 error (0, 0, _("error initializing month strings"));
57+#endif
58 }
59
60 return optind;