aboutsummaryrefslogtreecommitdiff
path: root/locale/programs/locale.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-05-07 15:31:21 +0000
committerUlrich Drepper <drepper@redhat.com>1997-05-07 15:31:21 +0000
commit51702635af8445431054291c86aaace7c30b0970 (patch)
treee9cc4d28c401bd6046f71f62d186865d37c0141f /locale/programs/locale.c
parent1f07e6177553845817af5f7c90f148edd2e59d32 (diff)
downloadglibc-51702635af8445431054291c86aaace7c30b0970.zip
glibc-51702635af8445431054291c86aaace7c30b0970.tar.gz
glibc-51702635af8445431054291c86aaace7c30b0970.tar.bz2
* locale/categories.def: Change type of _NL_CTYPE_CLASS_NAMES and _NL_CTYPE_MAP_NAMES field to stringlist. Change name of _NL_CTYPE_CODESET_NAME to "charmap". * locale/localeinfo.h (enum value_type): Add stringlist. * locale/programs/locale.c (show_info): Handle stringlist. * locale/programs/charmap.c (charmap_read): If charmap file is not using the given name try to find it by looking through all available charmap files and compare the code set name. * locale/programs/locale.c (write_charmaps): Also print names of charset in <code_set_name> fields in the files. * elf/ldd.bash.in: Correct translatable strings. * posix/TESTS: Add some more tests for character class matching. * posix/regex.c: Merge with GNU awk version. (regex_compile): Use ISO C/amend 1 functions for character class handling. * posix/regex.h: Merge with GNU awk version. * posix/getopt.c: Declare as master copies. * posix/getopt1.c: Likewise. * posix/getopt.h: Likewise. * sysdeps/unix/sysv/linux/sys/mount.h: Add definitions for option value to mount functions. Patch by a sun <asun@zoology.washington.edu>. * stdio-common/bug4.c (main): Use /tmp/bug4.test for concurrency with other tests. * sunrpc/svc_run.c (svc_exit): New, defined. (svc_run): Test for svc_stop variable. * sysdeps/m68k/s_cexp.c: Rewritten. * sysdeps/m68k/s_cexpf.c: Likewise. * sysdeps/m68k/s_cexpl.c: Likewise.
Diffstat (limited to 'locale/programs/locale.c')
-rw-r--r--locale/programs/locale.c63
1 files changed, 59 insertions, 4 deletions
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 7b0aaaa..28ad944 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -456,7 +456,9 @@ write_charmaps (void)
if (strcmp (dirent->d_name, ".") != 0
&& strcmp (dirent->d_name, "..") != 0)
{
+ char *buf = NULL;
mode_t mode;
+
#ifdef _DIRENT_HAVE_D_TYPE
if (dirent->d_type != DT_UNKNOWN)
mode = DTTOIF (dirent->d_type);
@@ -464,7 +466,8 @@ write_charmaps (void)
#endif
{
struct stat st;
- char buf[sizeof (CHARMAP_PATH) + strlen (dirent->d_name) + 1];
+
+ buf = alloca (sizeof (CHARMAP_PATH) + strlen (dirent->d_name) + 1);
stpcpy (stpcpy (stpcpy (buf, CHARMAP_PATH), "/"), dirent->d_name);
@@ -474,7 +477,44 @@ write_charmaps (void)
}
if (S_ISREG (mode))
- PUT (strdup (dirent->d_name));
+ {
+ FILE *fp;
+
+ PUT (strdup (dirent->d_name));
+
+ /* Read the file and learn about the code set name. */
+ if (buf == NULL)
+ {
+ buf = alloca (sizeof (CHARMAP_PATH)
+ + strlen (dirent->d_name) + 1);
+
+ stpcpy (stpcpy (stpcpy (buf, CHARMAP_PATH), "/"),
+ dirent->d_name);
+ }
+
+ fp = fopen (buf, "r");
+ if (fp != NULL)
+ {
+ char *name = NULL;
+
+ while (!feof (fp))
+ {
+ char junk[BUFSIZ];
+
+ if (fscanf (fp, " <code_set_name> %as", &name) == 1)
+ break;
+
+ do
+ fgets (junk, sizeof junk, fp);
+ while (strchr (junk, '\n') == NULL);
+ }
+
+ fclose (fp);
+
+ if (name != NULL)
+ PUT (name);
+ }
+ }
}
closedir (dir);
@@ -496,8 +536,8 @@ show_locale_vars (void)
{
char *val = getenv (name);
- if (lcall != NULL || val == NULL)
- printf ("%s=\"%s\"\n", name, lcall ? : lang);
+ if ((lcall ?: "")[0] != '\0' || val == NULL)
+ printf ("%s=\"%s\"\n", name, (lcall ?: "")[0] ? lcall : lang);
else
printf ("%s=%s\n", name, val);
}
@@ -553,6 +593,21 @@ show_info (const char *name)
putchar ('"');
}
break;
+ case stringlist:
+ {
+ int first = 1;
+ const char *val = nl_langinfo (item->item_id) ? : "";
+
+ while (*val != '\0')
+ {
+ printf ("%s%s%s%s", first ? "" : ";",
+ show_keyword_name ? "\"" : "", val,
+ show_keyword_name ? "\"" : "");
+ val = strchr (val, '\0') + 1;
+ first = 0;
+ }
+ }
+ break;
case byte:
{
const char *val = nl_langinfo (item->item_id);