Browse Source

Add a dummy (always fails) wcsftime. This is needed for the libstdc++ locale
implementation to build. Later this month I'll add a functional wcsftime.

Manuel Novoa III 21 years ago
parent
commit
5dd9f2af4b
3 changed files with 36 additions and 2 deletions
  1. 0 2
      include/wchar.h
  2. 4 0
      libc/misc/time/Makefile
  3. 32 0
      libc/misc/time/time.c

+ 0 - 2
include/wchar.h

@@ -842,7 +842,6 @@ extern int fputws_unlocked (__const wchar_t *__restrict __ws,
 #endif
 
 
-#if 0
 __BEGIN_NAMESPACE_C99
 /* Format TP into S according to FORMAT.
    Write no more than MAXSIZE wide characters and return the number
@@ -868,7 +867,6 @@ extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 			  __locale_t __loc) __THROW;
 #endif /* __UCLIBC_HAS_XLOCALE__ */
 # endif
-#endif /* 0 */
 
 /* The X/Open standard demands that most of the functions defined in
    the <wctype.h> header must also appear here.  This is probably

+ 4 - 0
libc/misc/time/Makefile

@@ -38,6 +38,10 @@ ifeq ($(UCLIBC_HAS_XLOCALE),y)
 endif
 
 ifeq ($(UCLIBC_HAS_WCHAR),y)
+	MOBJ += wcsftime.o
+ifeq ($(UCLIBC_HAS_XLOCALE),y)
+	MOBJx += wcsftime_l.o
+endif
 endif
 
 CSRC= adjtime.c ftime.c clock_gettime.c

+ 32 - 0
libc/misc/time/time.c

@@ -2210,6 +2210,38 @@ time_t _time_mktime(struct tm *timeptr, int store_on_success)
 	return t;
 }
 
+#endif
+/**********************************************************************/
+#if defined(L_wcsftime) || defined(L_wcsftime_l)
+
+#if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE)
+
+extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
+			  __const wchar_t *__restrict __format,
+			  __const struct tm *__restrict __timeptr,
+			  __locale_t __loc) __THROW;
+
+size_t wcsftime(wchar_t *__restrict s, size_t maxsize,
+				const wchar_t *__restrict format,
+				const struct tm *__restrict timeptr)
+{
+	return __wcsftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE);
+}
+
+#else  /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
+
+size_t __XL(wcsftime)(wchar_t *__restrict s, size_t maxsize,
+					  const wchar_t *__restrict format,
+					  const struct tm *__restrict timeptr   __LOCALE_PARAM )
+{
+#warning wcsftime always fails
+	return 0;					/* always fail */
+}
+
+__XL_ALIAS(wcsftime)
+
+#endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
+
 #endif
 /**********************************************************************/
 #ifdef L_dysize