(0006393)
geoffclare (manager)
2023-07-18 16:18
edited on: 2023-07-18 16:22
|
Since the specification for getlocalename_l() in the draft was based on the __getlocalename_l() function in Solaris 11.4, I checked how that function behaves when called with LC_ALL. It does actually do what is being asked for here, i.e. it returns the same string that setlocale() would return for the equivalent global locale setting:
$ LC_TIME=en_GB LC_MONETARY=en_US ./a.out
__getlocalename_l: /C/C/en_GB/C/en_US/C
setlocale : /C/C/en_GB/C/en_US/C
So I am in favour of making a normative text change along the lines suggested.
However, I am dubious about the suggested rationale addition of a use case in recording the information, as there is no requirement that the string contains printable characters, and storing it for use in a later setlocale() call (by another process) would be fragile, as a future OS upgrade could change the string format. A possible genuine use case might be an application that has a locale object and wants to duplicate its locale settings in the global locale.
|
(0006395)
geoffclare (manager)
2023-07-20 16:19
|
Change:The getlocalename_l() function shall return the locale name for the given locale category of the locale object locobj, or of the global locale if locobj is the special locale object LC_GLOBAL_LOCALE.
The category 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()]), getlocalename_l() shall fail. to:If category is not LC_ALL, the getlocalename_l() function shall return the locale name for the given locale category of the locale object locobj, or of the global locale if locobj is the special locale object LC_GLOBAL_LOCALE.
If category is LC_ALL, the getlocalename_l() function shall return a string that encodes the locale settings for all locale categories of the locale object locobj, or of the global locale if locobj is the special locale object LC_GLOBAL_LOCALE, in the same form as is returned by setlocale(). The string returned is such that a subsequent call to setlocale(), from the same process, with a pointer to that string as locale and the LC_ALL category shall set the global locale to the same locale for each category as was present in the queried object.
If the value of the category argument is neither LC_ALL nor a supported locale category value (see [xref to setlocale()]), getlocalename_l() shall fail.
Change APPLICATION USAGE from "None" to:In addition to the caveats regarding validity of the returned string pointer in RETURN VALUE, the content of the string returned when category is LC_ALL is only required to be valid for the life of the process, so is not intended for storage or sharing between processes. As the internal format of the string is implementation-specific, there is nothing preventing a subsequent run of an application from being presented a different format, for example if the implementation is updated. |