This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The content of LC_IDENTIFICATION


[Keld Jørn Simonsen]
> I think the value should be used to determine parsing of each
> category of the locale. Or should parsing just be the superset of
> all of the syntaxes? I am not aware of any conflicts. 14652 should
> be a true extension of posix:1993 and posix:2002.

I believe that is best left for a future extension.

> I do think that we should try to clean up the values, and we could
> do that by issuing a warning from localedef when wrong values are
> encountered.

Agreed.  Here is a patch to do it.  I'm not sure which codes should be
recognized, but used your list as a start.

--- ld-identification.c.~1.11.~	Thu Apr 18 09:53:59 2002
+++ ld-identification.c	Mon Jun 16 22:45:21 2003
@@ -295,6 +295,42 @@
 		     iov);
 }
 
+static int
+is_known_standard(const char *s)
+{
+  static struct {
+    const char *code;
+    const char *name;
+    const char *url;
+  } standards[] =
+    {
+      {
+	"posix:1993",
+	"ISO/IEC 9945-2:1993",
+	"(not freely available)"
+      },{
+	"posix:2002",
+	"ISO/IEC 9945:2002",
+	"http://www.unix-systems.org/version3/";
+      }, {
+	"i18n:1997",
+	"ISO/IEC FCD 14652",
+	"http://www.dkuug.dk/JTC1/SC22/open/n2638/";
+      }, {
+	"i18n:2003",
+	"ISO/IEC TR 14652:2003",
+	"http://www.dkuug.dk/JTC1/SC22/WG20/docs/n972-14652ft.pdf";
+      }
+    };
+  int i;
+  for (i = 0; i < sizeof(standards)/sizeof(standards[0]); ++i)
+    {
+      if (0 == strcmp(standards[i].code, s))
+	return 1; /* true */
+    }
+  return 0; /* false */
+}
+
 
 /* The parser for the LC_IDENTIFICATION section of the locale definition.  */
 void
@@ -402,6 +438,15 @@
 	  arg = lr_token (ldfile, charmap, result, NULL, verbose);
 	  if (arg->tok != tok_string && arg->tok != tok_ident)
 	    goto err_label;
+	  if (!is_known_standard(arg->val.str.startmb))
+	    {
+#if 0 /* Need to fix locales first */
+	      lr_error(ldfile, _("Unknown standard spec '%s'."),
+		       arg->val.str.startmb);
+#else
+	      printf(_("Unknown standard spec '%s'.\n"),arg->val.str.startmb);
+#endif
+	    }
 	  /* Next is a semicolon.  */
 	  cattok = lr_token (ldfile, charmap, result, NULL, verbose);
 	  if (cattok->tok != tok_semicolon)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]