bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] strftime merge from coreutils


From: Paul Eggert
Subject: [Bug-gnulib] strftime merge from coreutils
Date: 15 Aug 2003 22:41:47 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

I installed this change, mostly merged from coretuils:

2003-08-15  Jim Meyering  <address@hidden>
        and Paul Eggert  <address@hidden>

        * modules/strftime: Depend on tzset.
        * lib/strftime.c (my_strftime) [!_LIBC && HAVE_TZNAME && HAVE_TZSET]:
        Remove function, now that we can rely on a working tzset function.
        [!_LIBC]: Ensure that the required autoconf test has been run.
        [!defined _NL_CURRENT && HAVE_STRFTIME]:
        Use underlying_strftime for %r.
        * m4/strftime.m4 (_jm_STRFTIME_PREREQS):
        Require gl_FUNC_TZSET_CLOBBER.

Index: modules/strftime
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/strftime,v
retrieving revision 1.4
diff -p -u -r1.4 strftime
--- modules/strftime    20 Jan 2003 10:02:38 -0000      1.4
+++ modules/strftime    16 Aug 2003 04:11:56 -0000
@@ -8,6 +8,7 @@ m4/tm_gmtoff.m4
 m4/strftime.m4
 
 Depends-on:
+tzset
 
 configure.ac:
 jm_FUNC_GNU_STRFTIME
Index: lib/strftime.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strftime.c,v
retrieving revision 1.70
diff -p -u -r1.70 strftime.c
--- lib/strftime.c      9 Jul 2003 22:48:53 -0000       1.70
+++ lib/strftime.c      16 Aug 2003 04:11:57 -0000
@@ -492,25 +492,11 @@ static CHAR_T const month_name[][10] =
 # define ns 0
 #endif
 
-#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
-  /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
-     Work around this bug by copying *tp before it might be munged.  */
-  size_t _strftime_copytm __P ((char *, size_t, const char *,
-                               const struct tm * extra_args_spec_iso));
-  size_t
-  my_strftime (s, maxsize, format, tp extra_args)
-      CHAR_T *s;
-      size_t maxsize;
-      const CHAR_T *format;
-      const struct tm *tp;
-      extra_args_spec
-  {
-    struct tm tmcopy;
-    tmcopy = *tp;
-    return _strftime_copytm (s, maxsize, format, &tmcopy extra_args);
-  }
-# undef my_strftime
-# define my_strftime _strftime_copytm
+#if ! defined _LIBC && ! HAVE_RUN_TZSET_TEST
+/* Solaris 2.5.x and 2.6 tzset sometimes modify the storage returned
+   by localtime.  On such systems, we must use the tzset and localtime
+   wrappers to work around the bug.  */
+"you must run the autoconf test for a working tzset function"
 #endif
 
 
@@ -614,7 +600,7 @@ my_strftime (s, maxsize, format, tp extr
       int pad = 0;             /* Padding for number ('-', '_', or 0).  */
       int modifier;            /* Field modifier ('E', 'O', or 0).  */
       int digits;              /* Max digits for numeric format.  */
-      int number_value;        /* Numeric value to be printed.  */
+      int number_value;                /* Numeric value to be printed.  */
       int negative_number;     /* 1 if the number is negative.  */
       const CHAR_T *subfmt;
       CHAR_T *bufp;
@@ -1028,7 +1014,7 @@ my_strftime (s, maxsize, format, tp extr
            do
              *--bufp = u % 10 + L_('0');
            while ((u /= 10) != 0);
-         }
+         }
 
        do_number_sign_and_padding:
          if (negative_number)
@@ -1170,13 +1156,17 @@ my_strftime (s, maxsize, format, tp extr
          goto subformat;
 
        case L_('r'):
-#ifdef _NL_CURRENT
+#if !defined _NL_CURRENT && HAVE_STRFTIME
+         goto underlying_strftime;
+#else
+# ifdef _NL_CURRENT
          if (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME,
                                                       NLW(T_FMT_AMPM)))
              == L_('\0'))
-#endif
+# endif
            subfmt = L_("%I:%M:%S %p");
          goto subformat;
+#endif
 
        case L_('S'):
          if (modifier == L_('E'))
@@ -1185,7 +1175,7 @@ my_strftime (s, maxsize, format, tp extr
          DO_NUMBER (2, tp->tm_sec);
 
        case L_('s'):           /* GNU extension.  */
-         {
+         {
            struct tm ltm;
            time_t t;
 
Index: m4/strftime.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/strftime.m4,v
retrieving revision 1.27
diff -p -u -r1.27 strftime.m4
--- m4/strftime.m4      31 Dec 2002 13:43:06 -0000      1.27
+++ m4/strftime.m4      16 Aug 2003 04:11:57 -0000
@@ -1,4 +1,4 @@
-#serial 19
+#serial 20
 
 dnl This macro is intended to be used solely in this file.
 dnl These are the prerequisite macros for GNU's strftime.c replacement.
@@ -18,6 +18,7 @@ AC_DEFUN([_jm_STRFTIME_PREREQS],
  AC_TYPE_MBSTATE_T
 
  AC_REQUIRE([gl_TM_GMTOFF])
+ AC_REQUIRE([gl_FUNC_TZSET_CLOBBER])
 ])
 
 dnl From Jim Meyering.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]