A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1220 ====================================================================== Reported By: bhaible Assigned To: ====================================================================== Project: 1003.1(2016/18)/Issue7+TC2 Issue ID: 1220 Category: System Interfaces Type: Omission Severity: Editorial Priority: normal Status: New Name: Bruno Haible Organization: GNU User Reference: Section: --- Page Number: --- Line Number: --- Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2018-12-20 13:46 UTC Last Modified: 2020-10-05 11:11 UTC ====================================================================== Summary: Add an API to query the name of a locale category of a locale object ======================================================================
---------------------------------------------------------------------- (0005026) geoffclare (manager) - 2020-10-05 11:11 https://austingroupbugs.net/view.php?id=1220#c5026 ---------------------------------------------------------------------- Suggested changes to go into The Open Group company review... (The main differences from the desired action are the addition of the <locale.h> change, avoidance of the word "must", and requiring that a null pointer is returned when <i>category</i> is invalid, instead of the behaviour being undefined.) On page 286 line 9687 section <locale.h>, add:<blockquote><pre>[CX]const char *getlocalename_l (int, locale_t);[/CX]</pre></blockquote> On page 1050 insert a new getlocalename_l page: <b>NAME</b><blockquote>getlocalename_l - get a locale name from a locale object</blockquote> <b>SYNOPSIS</b><blockquote><pre>[CX]#include <locale.h> const char * getlocalename_l (int category, locale_t locobj);[/CX]</pre></blockquote> <b>DESCRIPTION</b><blockquote>The <i>getlocalename_l</i>() function shall return the locale name for the given locale category of the locale object <i>locobj</i>. The <i>category</i> argument specifies the locale category to be queried. If the value is LC_ALL or is not a supported locale category value (see [xref to setlocale()]), <i>getlocalename_l</i>() shall fail. The behavior is undefined if the <i>locobj</i> argument is the special locale object LC_GLOBAL_LOCALE or is not a valid locale object handle.</blockquote> <b>RETURN VALUE</b><blockquote>Upon successful completion, <i>getlocalename_l</i>() shall return a pointer to a string containing the locale name; otherwise, a null pointer shall be returned. The returned string shall remain valid until the locale object <i>locobj</i> is used in a call to <i>freelocale</i>() or as the <i>base</i> argument in a successful call to <i>newlocale</i>().</blockquote> <b>ERRORS</b><blockquote>No errors are defined.</blockquote> <b>EXAMPLES</b><blockquote><b>Determining the locale name for a category of the current locale</b> The following example shows how to extract the locale name for the LC_NUMERIC category of the current thread-local locale, or of the global locale if no thread-local locale is in use.<pre>#include <locale.h> ... const char *name; locale_t loc = uselocale(NULL); if (loc == LC_GLOBAL_LOCALE) name = setlocale(LC_NUMERIC, NULL); else name = getlocalename_l(LC_NUMERIC, loc);</pre></blockquote> <b>APPLICATION USAGE</b><blockquote>Applications need to ensure that they do not pass the special locale object handle LC_GLOBAL_LOCALE as the <i>locobj</i> argument, even when returned by the <i>uselocale</i>() function.</blockquote> <b>RATIONALE</b><blockquote>None.</blockquote> <b>FUTURE DIRECTIONS</b><blockquote>None.</blockquote> <b>SEE ALSO</b><blockquote>freelocale(), newlocale(), setlocale(), uselocale() XBD Chapter 7 (on page XXX), <locale.h></blockquote> <b>CHANGE HISTORY</b><blockquote>First released in Issue 8.</blockquote> Add getlocalename_l() to the SEE ALSO section for each page listed in the getlocalename_l() SEE ALSO above. On page 3791 line 130104 section E.1, add getlocalename_l() to the POSIX_MULTI_CONCURRENT_LOCALES subprofile group. Issue History Date Modified Username Field Change ====================================================================== 2018-12-20 13:46 bhaible New Issue 2018-12-20 13:46 bhaible Name => Bruno Haible 2018-12-20 13:46 bhaible Organization => GNU 2018-12-20 13:46 bhaible Section => --- 2018-12-20 13:46 bhaible Page Number => --- 2018-12-20 13:46 bhaible Line Number => --- 2020-10-05 11:11 geoffclare Note Added: 0005026 ======================================================================