On 3/29/25 12:05 AM, Lawrence Velázquez wrote:
On Thu, Mar 27, 2025, at 5:22 PM, Chet Ramey wrote:On 3/26/25 6:29 PM, Robert Elz wrote:LANG is generally just the fallback for categories that haven't been set to something else. For this, assume the LC_ALL had never been set (setting LANG after that is set should probably just do nothing) so we have explicitly set LC_CTYPE, and then LANG, what should the shell do with that one? Lookup all the category vars (how does the shell author even know what they all are - we know the basic ones, but I believe locales can add more categories) and set the ones which no var is set to to the locale being assigned to LANG?I'd argue that the shell should modify the locale categories that affect its behavior. That's a tricky business, no doubt, but it bounds the effects (or you could just pay attention to all the categories that POSIX defines). Plus there's nothing in POSIX that I can see that allows locale definitions to add additional categories.Maybe this does?
OK, permitted, at least in theory.
The locale definition file shall contain one or more locale category source definitions, and shall not contain more than one definition for the same locale category. If the file contains source definitions for more than one category, implementation-defined categories, if present, shall appear after the categories defined by 7.1 General. (Where "the categories defined by 7.1 General" are LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, LC_TIME, and LC_MESSAGES.)
How does a locale doing this expose the category to the programmer? I suppose all possible additional locale categories have to be available to setlocale() somehow, via <locale.h> and the documentation. Does anyone have an example of a locale that defines additional categories? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature