summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-03-15 14:49:56 +0000
committerJim Meyering <jim@meyering.net>2001-03-15 14:49:56 +0000
commita5d6ae87e0f935bf2dda042b175108bcb5797d62 (patch)
tree591700508ba9d932624e727556f5b13d30591c16
parent1341235a1c8f00ca832654ff0f4599e2998cab76 (diff)
downloadcoreutils-a5d6ae87e0f935bf2dda042b175108bcb5797d62.tar.xz
(locale_charset): Allow wildcard syntax. Also resolve
alias if codeset is empty.
-rw-r--r--lib/localcharset.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/localcharset.c b/lib/localcharset.c
index fa6f8a34a..575372dca 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -252,18 +252,17 @@ locale_charset ()
if (codeset == NULL)
/* The canonical name cannot be determined. */
codeset = "";
- else if (codeset[0] != '\0')
- {
- /* Resolve alias. */
- for (aliases = get_charset_aliases ();
- *aliases != '\0';
- aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
- if (!strcmp (codeset, aliases))
- {
- codeset = aliases + strlen (aliases) + 1;
- break;
- }
- }
+
+ /* Resolve alias. */
+ for (aliases = get_charset_aliases ();
+ *aliases != '\0';
+ aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
+ if (strcmp (codeset, aliases) == 0
+ || (aliases[0] == '*' && aliases[1] == '\0'))
+ {
+ codeset = aliases + strlen (aliases) + 1;
+ break;
+ }
return codeset;
}