This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/ob] Add _DATE_FMT for nl_langinfo


Hi,

I applied the below patch as obvious.  There was no way to access the
lc_time_T member date_fmt.  The GNU C library defines an nl_time
_DATE_FMT to access this member, and it is used in coreutils' date(1)
application if available.


Corinna


	* libc/include/langinfo.h (_NL_TIME_DATE_FMT): Define new nl_item
	value for LC_TIME entry date_fmt.
	(_DATE_FMT): Define "official" GNU name same as _NL_TIME_DATE_FMT.
	* libc/locale/nl_langinfo.c (nl_langinfo): Add case for _DATE_FMT.


Index: libc/locale/nl_langinfo.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/locale/nl_langinfo.c,v
retrieving revision 1.9
diff -u -p -r1.9 nl_langinfo.c
--- libc/locale/nl_langinfo.c	18 Feb 2010 17:35:15 -0000	1.9
+++ libc/locale/nl_langinfo.c	22 Feb 2010 10:17:52 -0000
@@ -189,6 +189,9 @@ _DEFUN(nl_langinfo, (item), 
 	case ALT_DIGITS:
 		ret = (char*) __get_current_time_locale()->alt_digits;
 		break;
+	case _DATE_FMT:	/* GNU extension */
+		ret = (char*) __get_current_time_locale()->date_fmt;
+		break;
 	case RADIXCHAR:
 		ret = (char*) __get_current_numeric_locale()->decimal_point;
 		break;
Index: libc/include/langinfo.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/langinfo.h,v
retrieving revision 1.1
diff -u -p -r1.1 langinfo.h
--- libc/include/langinfo.h	23 Aug 2002 01:56:02 -0000	1.1
+++ libc/include/langinfo.h	22 Feb 2010 10:17:52 -0000
@@ -133,6 +133,9 @@ typedef int nl_item;
 #define _NL_CTYPE_EXTRA_MAP_13 82
 #define _NL_CTYPE_EXTRA_MAP_14 83
 
+#define _NL_TIME_DATE_FMT 84
+#define _DATE_FMT _NL_TIME_DATE_FMT
+
 __BEGIN_DECLS
 char	*nl_langinfo(nl_item);
 __END_DECLS


-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]