Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37038356
en ru br
Репозитории ALT
S:9.4.0.24.75e248-alt1
5.1: 7.6-alt1
4.1: 6.11-alt1
4.0: 5.97-alt6
3.0: 5.3.1-alt0.4
www.altlinux.org/Changes

Другие репозитории
Upstream:8.1pl3

Группа :: Система/Основа
Пакет: coreutils

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: coreutils-5.91-eggert-ls-time-style.patch
Скачать


2005-09-27  Paul Eggert  <eggert@cs.ucla.edu>
	* NEWS: ls now defaults to --time-style="locale", but this
	style now behaves like posix-long-iso if your locale appears
	to be messed up.
	* doc/coreutils.texi (Formatting file timestamps): Document that
	--time-style="locale" is now the default.  Update advice for
	Emacs 21.3 and later.
	* src/ls.c (decode_switches): Implement the above.
Index: NEWS
===================================================================
RCS file: /fetish/cu/NEWS,v
retrieving revision 1.313
diff -p -u -r1.313 NEWS
--- NEWS	25 Sep 2005 06:07:48 -0000	1.313
+++ NEWS	27 Sep 2005 20:38:29 -0000
@@ -1,5 +1,11 @@
 GNU coreutils NEWS                                    -*- outline -*-
 
+** ls now defaults to --time-style="locale" rather than
+  --time-style="posix-long-iso".  However, --time-style="locale" now
+  behaves like --time-style="posix-long-iso" if your locale settings
+  appear to be messed up.  This change attempts to have the default be
+  the best of both worlds.
+
 * Major changes in release 5.91 (2005-10-17) [stable candidate]
 
 ** Bring back support for `head -NUM', `tail -NUM', etc. even when
Index: doc/coreutils.texi
===================================================================
RCS file: /fetish/cu/doc/coreutils.texi,v
retrieving revision 1.285
diff -p -u -r1.285 coreutils.texi
--- doc/coreutils.texi	25 Sep 2005 06:08:17 -0000	1.285
+++ doc/coreutils.texi	27 Sep 2005 20:38:32 -0000
@@ -6047,7 +6047,7 @@ and might generate timestamps like @samp
 @vindex LC_TIME
 List @acronym{POSIX}-locale timestamps if the @env{LC_TIME} locale
 category is @acronym{POSIX}, @var{style} timestamps otherwise.  For
-example, the default style, which is @samp{posix-long-iso}, lists
+example, the @samp{posix-long-iso} style lists
 timestamps like @samp{Mar 30@ @ 2002} and @samp{Mar 30 23:45} when in
 the @acronym{POSIX} locale, and like @samp{2002-03-30 23:45} otherwise.
 @end table
@@ -6056,10 +6056,11 @@ the @acronym{POSIX} locale, and like @sa
 @vindex TIME_STYLE
 You can specify the default value of the @option{--time-style} option
 with the environment variable @env{TIME_STYLE}; if @env{TIME_STYLE} is not set
-the default style is @samp{posix-long-iso}.  @acronym{GNU} Emacs 21 and
-later can parse @acronym{ISO} dates, but older Emacs versions do not, so if
-you are using an older version of Emacs and specify a non-@acronym{POSIX}
-locale, you may need to set @samp{TIME_STYLE="locale"}.
+the default style is @samp{locale}.  @acronym{GNU} Emacs 21.3 and
+later use the @option{--dired} option and therefore can parse any date
+format, but if you are using Emacs 21.1 or 21.2 and specify a
+non-@acronym{POSIX} locale you may need to set
+@samp{TIME_STYLE="posix-long-iso"}.
 
 To avoid certain denial-of-service attacks, timestamps that would be
 longer than 1000 bytes may be treated as errors.
Index: src/ls.c
===================================================================
RCS file: /fetish/cu/src/ls.c,v
retrieving revision 1.399
diff -p -u -r1.399 ls.c
--- src/ls.c	16 Sep 2005 07:50:33 -0000	1.399
+++ src/ls.c	27 Sep 2005 20:38:33 -0000
@@ -1823,7 +1823,7 @@ decode_switches (int argc, char **argv)
 
       if (! style)
 	if (! (style = getenv ("TIME_STYLE")))
-	  style = "posix-long-iso";
+	  style = "locale";
 
       while (strncmp (style, posix_prefix, sizeof posix_prefix - 1) == 0)
 	{
@@ -1859,6 +1859,7 @@ decode_switches (int argc, char **argv)
 	    break;
 
 	  case long_iso_time_style:
+	  case_long_iso_time_style:
 	    long_time_format[0] = long_time_format[1] = "%Y-%m-%d %H:%M";
 	    break;
 
@@ -1870,10 +1871,17 @@ decode_switches (int argc, char **argv)
 	  case locale_time_style:
 	    if (hard_locale (LC_TIME))
 	      {
+		/* Ensure that the locale has translations for both
+		   formats.  If not, fall back on long-iso format.  */
 		int i;
 		for (i = 0; i < 2; i++)
-		  long_time_format[i] =
-		    dcgettext (NULL, long_time_format[i], LC_TIME);
+		  {
+		    char const *locale_format =
+		      dcgettext (NULL, long_time_format[i], LC_TIME);
+		    if (locale_format == long_time_format[i])
+		      goto case_long_iso_time_style;
+		    long_time_format[i] = locale_format;
+		  }
 	      }
 	  }
     }
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin