From 3f19323a07001b569503e0d23d8b4c0f9d62c284 Mon Sep 17 00:00:00 2001 From: Isabell Long Date: Mon, 25 Jun 2012 21:51:40 +0000 Subject: [PATCH] Add more locale-specific functions to the relevant man pages and Makefiles: - libc/stdtime/strftime.3 - libc/stdtime/strptime.3 - libc/stdlib/strfmon.3 Reviewed by: theraven Approved by: gabor (mentor) --- lib/libc/stdlib/Makefile.inc | 1 + lib/libc/stdlib/strfmon.3 | 19 ++++++++++++++++++- lib/libc/stdtime/Makefile.inc | 2 ++ lib/libc/stdtime/strftime.3 | 13 ++++++++++++- lib/libc/stdtime/strptime.3 | 14 +++++++++++++- 5 files changed, 46 insertions(+), 3 deletions(-) diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index 7fdb6e42dd7f..75204f594435 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -42,6 +42,7 @@ MLINKS+=rand.3 rand_r.3 rand.3 srand.3 rand.3 sranddev.3 MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3 \ random.3 srandomdev.3 MLINKS+=radixsort.3 sradixsort.3 +MLINKS+=strfmon.3 strfmon_l.3 MLINKS+=strtod.3 strtof.3 strtod.3 strtold.3 MLINKS+=strtol.3 strtoll.3 strtol.3 strtoq.3 strtol.3 strtoimax.3 MLINKS+=strtoul.3 strtoull.3 strtoul.3 strtouq.3 strtoul.3 strtoumax.3 diff --git a/lib/libc/stdlib/strfmon.3 b/lib/libc/stdlib/strfmon.3 index 7a54f22bf25d..7934b520ad18 100644 --- a/lib/libc/stdlib/strfmon.3 +++ b/lib/libc/stdlib/strfmon.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 12, 2002 +.Dd June 25, 2012 .Dt STRFMON 3 .Os .Sh NAME @@ -36,6 +36,8 @@ .In monetary.h .Ft ssize_t .Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..." +.Ft ssize_t +.Fn strfmon_l "char * restrict s" "size_t maxsize" "locale_t loc" "const char * restrict format" "..." .Sh DESCRIPTION The .Fn strfmon @@ -47,6 +49,12 @@ No more than .Fa maxsize bytes are placed into the array. .Pp +The +.Fn strfmon_l +function does the same as +.Fn strfmon +but takes an explicit locale rather than using the current locale. +.Pp The format string is composed of zero or more directives: ordinary characters (not .Cm % ) , @@ -129,6 +137,11 @@ the contents of the array are indeterminate, and .Va errno is set to indicate the error. +.Pp +The +.Fn strfmon_l +function returns the same values as +.Fn strfmon . .Sh ERRORS The .Fn strfmon @@ -149,6 +162,10 @@ The function conforms to .St -p1003.1-2001 . +The +.Fn strfmon_l +function conforms to +.St -p1003.1-2008 . .Sh AUTHORS .An -nosplit The diff --git a/lib/libc/stdtime/Makefile.inc b/lib/libc/stdtime/Makefile.inc index a039bc9ab9ab..0cc038afcdf5 100644 --- a/lib/libc/stdtime/Makefile.inc +++ b/lib/libc/stdtime/Makefile.inc @@ -18,4 +18,6 @@ MLINKS+=ctime.3 asctime.3 ctime.3 difftime.3 ctime.3 gmtime.3 \ ctime.3 localtime.3 ctime.3 mktime.3 ctime.3 timegm.3 \ ctime.3 ctime_r.3 ctime.3 localtime_r.3 ctime.3 gmtime_r.3 \ ctime.3 asctime_r.3 +MLINKS+=strftime.3 strftime_l.3 +MLINKS+=strptime.3 strptime_l.3 MLINKS+=time2posix.3 posix2time.3 diff --git a/lib/libc/stdtime/strftime.3 b/lib/libc/stdtime/strftime.3 index d5cdd7dc5638..0ed023b2cb3a 100644 --- a/lib/libc/stdtime/strftime.3 +++ b/lib/libc/stdtime/strftime.3 @@ -32,7 +32,7 @@ .\" @(#)strftime.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 4, 2004 +.Dd June 25, 2012 .Dt STRFTIME 3 .Os .Sh NAME @@ -49,6 +49,8 @@ .Fa "const char * restrict format" .Fa "const struct tm * restrict timeptr" .Fc +.Ft size_t +.Fn strftime_l "char *restrict buf" "size_t maxsize" "const char * restrict format" "const struct tm *restrict timeptr" "locale_t loc" .Sh DESCRIPTION The .Fn strftime @@ -58,6 +60,11 @@ into the buffer .Fa buf according to the string pointed to by .Fa format . +The function +.Fn strftime_l +does the same as +.Fn strftime +but takes an explicit locale rather than using the current locale. .Pp The .Fa format @@ -268,6 +275,10 @@ The peculiar week number and year in the replacements of and .Ql \&%V are defined in ISO 8601: 1988. +The +.Fn strftime_l +function conforms to +.St -p1003.1-2008 . .Sh BUGS There is no conversion specification for the phase of the moon. .Pp diff --git a/lib/libc/stdtime/strptime.3 b/lib/libc/stdtime/strptime.3 index 763696b0b4ca..34d2b791e70c 100644 --- a/lib/libc/stdtime/strptime.3 +++ b/lib/libc/stdtime/strptime.3 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" " -.Dd January 4, 2003 +.Dd June 25, 2012 .Dt STRPTIME 3 .Os .Sh NAME @@ -41,6 +41,10 @@ .Fa "const char * restrict format" .Fa "struct tm * restrict timeptr" .Fc +.In time.h +.In xlocale.h +.Ft char * +.Fn strptime_l "const char * restrict buf" "const char * restrict format" "struct tm * restrict timeptr" "locale_t loc" .Sh DESCRIPTION The .Fn strptime @@ -53,6 +57,11 @@ and fills in the elements of the structure pointed to by The resulting values will be relative to the local time zone. Thus, it can be considered the reverse operation of .Xr strftime 3 . +The +.Fn strptime_l +function does the same as +.Fn strptime , +but takes an explicit locale rather than using the current locale. .Pp The .Fa format @@ -104,6 +113,9 @@ that has not been required to satisfy the specified conversions in It returns .Dv NULL if one of the conversions failed. +.Fn strptime_l +returns the same values as +.Fn strptime . .Sh SEE ALSO .Xr date 1 , .Xr scanf 3 ,