Magellan Linux

Annotation of /trunk/coreutils/patches-5.94/coreutils-5.3.0-timestyle.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 115 - (hide annotations) (download)
Sun Mar 18 15:57:37 2007 UTC (17 years, 2 months ago) by niro
File size: 3855 byte(s)
patches for 5.94

1 niro 115 POSIX allows for default output format to be either 'posix-long-iso'
2     or 'locale', so lets go with 'locale' instead and don't bother checking
3     the value of POSIXLY_CORRECT in env
4    
5     http://lists.gnu.org/archive/html/bug-coreutils/2005-08/msg00120.html
6     http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00162.html
7    
8     2005-09-27 Paul Eggert <eggert@cs.ucla.edu>
9    
10     * NEWS: ls now defaults to --time-style="locale", but this
11     style now behaves like posix-long-iso if your locale appears
12     to be messed up.
13     * doc/coreutils.texi (Formatting file timestamps): Document that
14     --time-style="locale" is now the default. Update advice for
15     Emacs 21.3 and later.
16     * src/ls.c (decode_switches): Implement the above.
17    
18     ** Bring back support for `head -NUM', `tail -NUM', etc. even when
19     Index: doc/coreutils.texi
20     ===================================================================
21     RCS file: /fetish/cu/doc/coreutils.texi,v
22     retrieving revision 1.285
23     diff -p -u -r1.285 coreutils.texi
24     --- doc/coreutils.texi 25 Sep 2005 06:08:17 -0000 1.285
25     +++ doc/coreutils.texi 27 Sep 2005 20:38:32 -0000
26     @@ -6047,7 +6047,7 @@ and might generate timestamps like @samp
27     @vindex LC_TIME
28     List @acronym{POSIX}-locale timestamps if the @env{LC_TIME} locale
29     category is @acronym{POSIX}, @var{style} timestamps otherwise. For
30     -example, the default style, which is @samp{posix-long-iso}, lists
31     +example, the @samp{posix-long-iso} style lists
32     timestamps like @samp{Mar 30@ @ 2002} and @samp{Mar 30 23:45} when in
33     the @acronym{POSIX} locale, and like @samp{2002-03-30 23:45} otherwise.
34     @end table
35     @@ -6056,10 +6056,11 @@ the @acronym{POSIX} locale, and like @sa
36     @vindex TIME_STYLE
37     You can specify the default value of the @option{--time-style} option
38     with the environment variable @env{TIME_STYLE}; if @env{TIME_STYLE} is not set
39     -the default style is @samp{posix-long-iso}. @acronym{GNU} Emacs 21 and
40     -later can parse @acronym{ISO} dates, but older Emacs versions do not, so if
41     -you are using an older version of Emacs and specify a non-@acronym{POSIX}
42     -locale, you may need to set @samp{TIME_STYLE="locale"}.
43     +the default style is @samp{locale}. @acronym{GNU} Emacs 21.3 and
44     +later use the @option{--dired} option and therefore can parse any date
45     +format, but if you are using Emacs 21.1 or 21.2 and specify a
46     +non-@acronym{POSIX} locale you may need to set
47     +@samp{TIME_STYLE="posix-long-iso"}.
48    
49     To avoid certain denial-of-service attacks, timestamps that would be
50     longer than 1000 bytes may be treated as errors.
51     Index: src/ls.c
52     ===================================================================
53     RCS file: /fetish/cu/src/ls.c,v
54     retrieving revision 1.399
55     diff -p -u -r1.399 ls.c
56     --- src/ls.c 16 Sep 2005 07:50:33 -0000 1.399
57     +++ src/ls.c 27 Sep 2005 20:38:33 -0000
58     @@ -1823,7 +1823,7 @@ decode_switches (int argc, char **argv)
59    
60     if (! style)
61     if (! (style = getenv ("TIME_STYLE")))
62     - style = "posix-long-iso";
63     + style = "locale";
64    
65     while (strncmp (style, posix_prefix, sizeof posix_prefix - 1) == 0)
66     {
67     @@ -1859,6 +1859,7 @@ decode_switches (int argc, char **argv)
68     break;
69    
70     case long_iso_time_style:
71     + case_long_iso_time_style:
72     long_time_format[0] = long_time_format[1] = "%Y-%m-%d %H:%M";
73     break;
74    
75     @@ -1870,10 +1871,17 @@ decode_switches (int argc, char **argv)
76     case locale_time_style:
77     if (hard_locale (LC_TIME))
78     {
79     + /* Ensure that the locale has translations for both
80     + formats. If not, fall back on long-iso format. */
81     int i;
82     for (i = 0; i < 2; i++)
83     - long_time_format[i] =
84     - dcgettext (NULL, long_time_format[i], LC_TIME);
85     + {
86     + char const *locale_format =
87     + dcgettext (NULL, long_time_format[i], LC_TIME);
88     + if (locale_format == long_time_format[i])
89     + goto case_long_iso_time_style;
90     + long_time_format[i] = locale_format;
91     + }
92     }
93     }
94     }
95