diff -rcN fileutils-4.1,original/src/dircolors.c fileutils-4.1/src/dircolors.c *** fileutils-4.1,original/src/dircolors.c Mon Aug 7 12:46:16 2000 --- fileutils-4.1/src/dircolors.c Wed Apr 9 01:02:14 2003 *************** *** 92,97 **** --- 92,102 ---- char *program_name; + static char + term_options[32] = { 0 }, + *term_color = "", + *term_eightbit = ""; + void usage (int status) { *************** *** 331,343 **** append_quoted (arg); APPEND_CHAR (':'); } ! else if (strcasecmp (keywd, "OPTIONS") == 0 ! || strcasecmp (keywd, "COLOR") == 0 ! || strcasecmp (keywd, "EIGHTBIT") == 0) ! { ! /* Ignore. */ ! } ! else { int i; --- 336,357 ---- append_quoted (arg); APPEND_CHAR (':'); } ! else if (strcasecmp (keywd, "OPTIONS") == 0) { ! strncpy(term_options, arg, sizeof(term_options)-1); ! term_options[sizeof(term_options)-1] = 0; ! } else if (strcasecmp (keywd, "COLOR") == 0) { ! if (strcasecmp(arg, "tty") == 0) ! term_color = "--color=auto"; ! else if (strcasecmp(arg, "all") == 0) ! term_color = "--color=always"; ! else if (strcasecmp(arg, "none") == 0) ! term_color = "--color=never"; ! } else if (strcasecmp (keywd, "EIGHTBIT") == 0) { ! if (strcasecmp(arg, "1") == 0) ! term_eightbit = ""; ! else if (strcasecmp(arg, "0") == 0) ! term_eightbit = ""; ! } else { int i; *************** *** 431,437 **** atexit (close_stdout); ! while ((optc = getopt_long (argc, argv, "bcp", long_options, NULL)) != -1) switch (optc) { case 'b': /* Bourne shell syntax. */ --- 445,451 ---- atexit (close_stdout); ! while ((optc = getopt_long (argc, argv, "bctp", long_options, NULL)) != -1) switch (optc) { case 'b': /* Bourne shell syntax. */ *************** *** 439,444 **** --- 453,459 ---- break; case 'c': /* C shell syntax. */ + case 't': /* legacy color-ls-3.12.0.3 switch */ syntax = SHELL_SYNTAX_C; break; *************** *** 518,534 **** if (syntax == SHELL_SYNTAX_BOURNE) { ! prefix = "LS_COLORS='"; ! suffix = "';\nexport LS_COLORS\n"; } else { ! prefix = "setenv LS_COLORS '"; ! suffix = "'\n"; } fputs (prefix, stdout); fwrite (s, 1, len, stdout); ! fputs (suffix, stdout); } } --- 533,564 ---- if (syntax == SHELL_SYNTAX_BOURNE) { ! prefix = "LS_COLORS='"; ! suffix = "';\n" ! "export LS_COLORS;\n" ! "LS_OPTIONS='%s %s %s';\n" ! "alias ls='/usr/bin/ls $LS_OPTIONS';\n" ! "alias dir='/usr/bin/ls $LS_OPTIONS --format=vertical';\n" ! "alias vdir='/usr/bin/ls $LS_OPTIONS --format=long';\n" ! "alias d=dir;\n" ! "alias v=vdir;\n"; } else { ! prefix = "set noglob;\n" ! "setenv LS_COLORS '"; ! suffix = "';\n" ! "setenv LS_OPTIONS '%s %s %s';\n" ! "alias ls '/usr/bin/ls $LS_OPTIONS';\n" ! "alias dir '/usr/bin/ls $LS_OPTIONS --format=vertical';\n" ! "alias vdir '/usr/bin/ls $LS_OPTIONS --format=long';\n" ! "alias d dir;\n" ! "alias v vdir;\n" ! "unset noglob;\n"; } fputs (prefix, stdout); fwrite (s, 1, len, stdout); ! fprintf (stdout, suffix, term_options, term_color, term_eightbit); } }