Deleted Added
full compact
42c42
< "$FreeBSD: head/bin/ls/print.c 86922 2001-11-26 22:21:15Z green $";
---
> "$FreeBSD: head/bin/ls/print.c 88583 2001-12-28 18:14:50Z joe $";
97c97
< char *defcolors = "4x5x2x3x1x464301060203";
---
> char *defcolors = "exfxcxdxbxegedabagacad";
99c99,104
< static int colors[C_NUMCOLORS][2];
---
> /* colors for file types */
> static struct {
> int num[2];
> int bold;
> } colors[C_NUMCOLORS];
>
389,390c394,398
< if (colors[c][0] != -1) {
< ansiseq = tgoto(ansi_fgcol, 0, colors[c][0]);
---
> if (colors[c].bold)
> tputs(enter_bold, 1, putch);
>
> if (colors[c].num[0] != -1) {
> ansiseq = tgoto(ansi_fgcol, 0, colors[c].num[0]);
395,396c403,404
< if (colors[c][1] != -1) {
< ansiseq = tgoto(ansi_bgcol, 0, colors[c][1]);
---
> if (colors[c].num[1] != -1) {
> ansiseq = tgoto(ansi_bgcol, 0, colors[c].num[1]);
406a415
> tputs(attrs_off, 1, sig ? writech : putch);
456a466
> short legacy_warn = 0;
460a471,472
> colors[i].bold = 0;
>
470,471c482,499
< if ((c[j] < '0' || c[j] > '7') &&
< tolower((unsigned char)c[j]) != 'x') {
---
> /* Legacy colours used 0-7 */
> if (c[j] >= '0' && c[j] <= '7') {
> colors[i].num[j] = c[j] - '0';
> if (!legacy_warn) {
> fprintf(stderr,
> "warn: colors are now defined "
> "using a-h instead of 0-9. "
> "see manual page.\n");
> }
> legacy_warn = 1;
> } else if (c[j] >= 'a' && c[j] <= 'h')
> colors[i].num[j] = c[j] - 'a';
> else if (c[j] >= 'A' && c[j] <= 'H') {
> colors[i].num[j] = c[j] - 'A';
> colors[i].bold = 1;
> } else if (tolower((unsigned char)c[j] == 'x'))
> colors[i].num[j] = -1;
> else {
473,475c501,503
< "error: invalid character '%c' in LSCOLORS env var\n",
< c[j]);
< c[j] = defcolors[2*i+j];
---
> "error: invalid character '%c' in LSCOLORS"
> " env var\n", c[j]);
> colors[i].num[j] = defcolors[2*i+j]-'0';
477,480d504
< if (tolower((unsigned char)c[j]) == 'x')
< colors[i][j] = -1;
< else
< colors[i][j] = c[j]-'0';