diff options
author | jbj <devnull@localhost> | 1999-08-21 23:07:22 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-08-21 23:07:22 +0000 |
commit | b2aff25f78baea9cfba2106702d8de63e4537e9c (patch) | |
tree | 2560d2394e816047f65ddad15835ad9f72bc6fa8 /lib/header.c | |
parent | d2094dc229f3efa82bde4c92d77d7314a370d4f0 (diff) | |
download | librpm-tizen-b2aff25f78baea9cfba2106702d8de63e4537e9c.tar.gz librpm-tizen-b2aff25f78baea9cfba2106702d8de63e4537e9c.tar.bz2 librpm-tizen-b2aff25f78baea9cfba2106702d8de63e4537e9c.zip |
Check POSIX environment variables too.
CVS patchset: 3244
CVS date: 1999/08/21 23:07:22
Diffstat (limited to 'lib/header.c')
-rw-r--r-- | lib/header.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/lib/header.c b/lib/header.c index 7d6cd9cc1..3448b124a 100644 --- a/lib/header.c +++ b/lib/header.c @@ -799,9 +799,36 @@ static int headerMatchLocale(const char *td, const char *l, const char *le) * dddd (optional) dialect. */ - /* First try a complete match. */ - if (!strncmp(td, l, (le - l))) - return 1; +#if 0 + /* Copy the buffer and parse out components on the fly. */ + lbuf = alloca(le - l + 1); + for (s = l, ll = t = lbuf; *s; s++, t++) { + switch (*s) { + case '_': + *t = '\0'; + CC = t + 1; + break; + case '.': + *t = '\0'; + EE = t + 1; + break; + case '@': + *t = '\0'; + dd = t + 1; + break; + default: + *t = *s; + break; + } + } + + if (ll) /* ISO language should be lower case */ + for (t = ll; *t; t++) *t = tolower(*t); + if (CC) /* ISO country code should be upper case */ + for (t = CC; *t; t++) *t = toupper(*t); + + /* There are a total of 16 cases to attempt to match. */ +#endif /* Next, try stripping optional dialect and matching. */ for (fe = l; fe < le && *fe != '@'; fe++) @@ -829,8 +856,10 @@ static char *headerFindI18NString(Header h, struct indexEntry *entry) const char *lang, *l, *le; struct indexEntry * table; - if (((lang = getenv("LANGUAGE")) == NULL && - (lang = getenv("LANG")) == NULL)) + if ((lang = getenv("LC_ALL")) == NULL && + (lang = getenv("LANGUAGE")) == NULL && + (lang = getenv("LC_MESSAGES")) == NULL && + (lang = getenv("LANG")) == NULL) return entry->data; if ((table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE)) == NULL) |