about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--time/Makefile8
-rw-r--r--time/Versions9
-rw-r--r--time/strftime_l.c22
-rw-r--r--time/time.h25
-rw-r--r--time/wcsftime_l.c22
-rw-r--r--wcsmbs/wchar.h15
7 files changed, 105 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index ae7c98c629..55da607296 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2002-08-27  Roland McGrath  <roland@redhat.com>
 
+	* time/time.h (__strptime_l, strptime_l): Declare them.
+
+	* time/time.h (__strftime_l, strftime_l): Declare them.
+	* wcsmbs/wchar.h (__wcsftime_l, wcsftime_l): Declare them.
+	* time/strftime_l.c: New file.
+	* time/wcsftime_l.c: New file.
+	* time/Makefile (routines): Add strftime_l, wcsftime_l.
+	* time/Versions (libc: GLIBC_2.3): Add __strftime_l, __wcsftime_l,
+	strftime_l, wcsftime_l.
+
 	* locale/Versions (libc: GLIBC_PRIVATE): Move __uselocale to ...
 	(libc: GLIBC_2.3): ... here.
 
diff --git a/time/Makefile b/time/Makefile
index f60dee0e28..5e55e3539f 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999,2000,01,02 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -24,12 +24,12 @@ subdir	:= time
 headers	:= time.h sys/time.h sys/timeb.h bits/time.h
 
 routines := offtime asctime clock ctime ctime_r difftime \
-	    gmtime localtime mktime strftime time	 \
+	    gmtime localtime mktime time		 \
 	    gettimeofday settimeofday adjtime tzset	 \
 	    tzfile getitimer setitimer			 \
 	    stime dysize timegm ftime			 \
-	    strptime getdate wcsftime
-
+	    strptime getdate				 \
+	    strftime wcsftime strftime_l wcsftime_l
 distribute := datemsk
 
 tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
diff --git a/time/Versions b/time/Versions
index f3bbb4df8b..616da7edc2 100644
--- a/time/Versions
+++ b/time/Versions
@@ -50,4 +50,13 @@ libc {
     # w*
     wcsftime;
   }
+  GLIBC_2.3 {
+    # s*
+    strftime_l;
+    # w*
+    wcsftime_l;
+
+    # these internal names are used by libstdc++
+    __strftime_l; __wcsftime_l;
+  }
 }
diff --git a/time/strftime_l.c b/time/strftime_l.c
new file mode 100644
index 0000000000..c6ecada4ce
--- /dev/null
+++ b/time/strftime_l.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define USE_IN_EXTENDED_LOCALE_MODEL 1
+#include <strftime.c>
+
+weak_alias (__strftime_l, strftime_l)
diff --git a/time/time.h b/time/time.h
index 117bf7b88f..dd7ce8dec5 100644
--- a/time/time.h
+++ b/time/time.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999,2000,01,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -188,6 +188,28 @@ extern char *strptime (__const char *__restrict __s,
      __THROW;
 # endif
 
+# ifdef __USE_GNU
+/* Similar to the two functions above but take the information from
+   the provided locale and not the global locale.  */
+# include <xlocale.h>
+
+extern size_t __strftime_l (char *__restrict __s, size_t __maxsize,
+			    __const char *__restrict __format,
+			    __const struct tm *__restrict __tp,
+			    __locale_t __loc) __THROW;
+extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
+			  __const char *__restrict __format,
+			  __const struct tm *__restrict __tp,
+			  __locale_t __loc) __THROW;
+
+extern char *__strptime_l (__const char *__restrict __s,
+			   __const char *__restrict __fmt, struct tm *__tp,
+			   __locale_t __loc) __THROW;
+extern char *strptime_l (__const char *__restrict __s,
+			 __const char *__restrict __fmt, struct tm *__tp,
+			 __locale_t __loc) __THROW;
+# endif
+
 
 /* Return the `struct tm' representation of *TIMER
    in Universal Coordinated Time (aka Greenwich Mean Time).  */
@@ -358,7 +380,6 @@ extern int getdate_r (__const char *__restrict __string,
 		      struct tm *__restrict __resbufp) __THROW;
 # endif
 
-
 __END_DECLS
 
 #endif /* <time.h> included.  */
diff --git a/time/wcsftime_l.c b/time/wcsftime_l.c
new file mode 100644
index 0000000000..969289710c
--- /dev/null
+++ b/time/wcsftime_l.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define USE_IN_EXTENDED_LOCALE_MODEL 1
+#include <wcsftime.c>
+
+weak_alias (__wcsftime_l, wcsftime_l)
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 6dacb2612e..777c73a08f 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -699,6 +699,21 @@ extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
 			__const wchar_t *__restrict __format,
 			__const struct tm *__restrict __tp) __THROW;
 
+# ifdef __USE_GNU
+# include <xlocale.h>
+
+/* Similar to `wcsftime' but takes the information from
+   the provided locale and not the global locale.  */
+extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
+			    __const wchar_t *__restrict __format,
+			    __const struct tm *__restrict __tp,
+			    __locale_t __loc) __THROW;
+extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
+			  __const wchar_t *__restrict __format,
+			  __const struct tm *__restrict __tp,
+			  __locale_t __loc) __THROW;
+# endif
+
 /* The X/Open standard demands that most of the functions defined in
    the <wctype.h> header must also appear here.  This is probably
    because some X/Open members wrote their implementation before the