summary refs log tree commit diff
path: root/locale/programs/locfile.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-30 18:52:38 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-30 18:52:38 +0000
commit12a9fabe52b88bdb75e305bbe485573d34bfbc24 (patch)
tree1ca0bd207f63fc1ea0202aad84cd1e7c8c744b8c /locale/programs/locfile.c
parent69f155d4fc11f2f0e1dd1bfcd804192303ba1627 (diff)
downloadglibc-12a9fabe52b88bdb75e305bbe485573d34bfbc24.tar.gz
glibc-12a9fabe52b88bdb75e305bbe485573d34bfbc24.tar.xz
glibc-12a9fabe52b88bdb75e305bbe485573d34bfbc24.zip
Update.
	* locale/programs/locfile.c: Interpret I18NPATH value as base of
	path, extended with "/locales/".
Diffstat (limited to 'locale/programs/locfile.c')
-rw-r--r--locale/programs/locfile.c111
1 files changed, 109 insertions, 2 deletions
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index ad7e9d5fb4..5a3fc25e3d 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -58,6 +58,7 @@ char *xstrdup (const char *__str);
 struct localedef_t *
 locfile_read (const char *filename, struct charset_t *charset)
 {
+  struct repertoire_t *repertoire = NULL;
   struct linereader *ldfile;
   struct localedef_t *result;
   int state;
@@ -80,7 +81,8 @@ locfile_read (const char *filename, struct charset_t *charset)
 	  char *i18npath = __secure_getenv ("I18NPATH");
 	  if (i18npath != NULL && *i18npath != '\0')
 	    {
-	      char path[strlen (filename) + 1 + strlen (i18npath) + 1];
+	      char path[strlen (filename) + 1 + strlen (i18npath)
+		        + sizeof ("/locales/") - 1];
 	      char *next;
 	      i18npath = strdupa (i18npath);
 
@@ -88,7 +90,7 @@ locfile_read (const char *filename, struct charset_t *charset)
 	      while (ldfile == NULL
 		     && (next = strsep (&i18npath, ":")) != NULL)
 		{
-		  stpcpy (stpcpy (stpcpy (path, next), "/"), filename);
+		  stpcpy (stpcpy (stpcpy (path, next), "/locales/"), filename);
 
 		  ldfile = lr_open (path, locfile_hash);
 		}
@@ -249,27 +251,132 @@ argument to `%s' must be a single character"),
 		ldfile->comment_char = *arg->val.str.start;
 	      break;
 
+	    case tok_repertoiremap:
+	      /* We need an argument.  */
+	      arg = lr_token (ldfile, charset);
+
+	      if (arg->tok != tok_ident)
+		{
+		  SYNTAX_ERROR (_("bad argument"));
+		  continue;
+		}
+
+	      if (repertoiremap == NULL)
+		{
+		  repertoiremap = memcpy (xmalloc (arg->val.str.len + 1),
+					  arg->val.str.start,
+					  arg->val.str.len);
+		  ((char *) repertoiremap)[arg->val.str.len] = '\0';
+		}
+
+	      lr_ignore_rest (ldfile, 1);
+	      continue;
+
 	    case tok_lc_ctype:
+	      if (repertoire == NULL)
+		{
+		  /* Read the repertoire map now.  */
+		  if (repertoiremap == NULL)
+		    /* This is fatal.  */
+		    error (4, 0,
+			   _("no repertoire map specified: cannot proceed"));
+
+		  repertoire = repertoire_read (repertoiremap);
+		  if (repertoire == NULL)
+		    /* This is also fatal.  */
+		    error (4, errno, _("cannot read repertoire map `%s'"),
+			   repertoiremap);
+		}
 	      state = 2;
 	      break;
 
 	    case tok_lc_collate:
+	      if (repertoire == NULL)
+		{
+		  /* Read the repertoire map now.  */
+		  if (repertoiremap == NULL)
+		    /* This is fatal.  */
+		    error (4, 0,
+			   _("no repertoire map specified: cannot proceed"));
+
+		  repertoire = repertoire_read (repertoiremap);
+		  if (repertoire == NULL)
+		    /* This is also fatal.  */
+		    error (4, errno, _("cannot read repertoire map `%s'"),
+			   repertoiremap);
+		}
 	      state = 10;
 	      break;
 
 	    case tok_lc_monetary:
+	      if (repertoire == NULL)
+		{
+		  /* Read the repertoire map now.  */
+		  if (repertoiremap == NULL)
+		    /* This is fatal.  */
+		    error (4, 0,
+			   _("no repertoire map specified: cannot proceed"));
+
+		  repertoire = repertoire_read (repertoiremap);
+		  if (repertoire == NULL)
+		    /* This is also fatal.  */
+		    error (4, errno, _("cannot read repertoire map `%s'"),
+			   repertoiremap);
+		}
 	      state = 20;
 	      break;
 
 	    case tok_lc_numeric:
+	      if (repertoire == NULL)
+		{
+		  /* Read the repertoire map now.  */
+		  if (repertoiremap == NULL)
+		    /* This is fatal.  */
+		    error (4, 0,
+			   _("no repertoire map specified: cannot proceed"));
+
+		  repertoire = repertoire_read (repertoiremap);
+		  if (repertoire == NULL)
+		    /* This is also fatal.  */
+		    error (4, errno, _("cannot read repertoire map `%s'"),
+			   repertoiremap);
+		}
 	      state = 30;
 	      break;
 
 	    case tok_lc_time:
+	      if (repertoire == NULL)
+		{
+		  /* Read the repertoire map now.  */
+		  if (repertoiremap == NULL)
+		    /* This is fatal.  */
+		    error (4, 0,
+			   _("no repertoire map specified: cannot proceed"));
+
+		  repertoire = repertoire_read (repertoiremap);
+		  if (repertoire == NULL)
+		    /* This is also fatal.  */
+		    error (4, errno, _("cannot read repertoire map `%s'"),
+			   repertoiremap);
+		}
 	      state = 40;
 	      break;
 
 	    case tok_lc_messages:
+	      if (repertoire == NULL)
+		{
+		  /* Read the repertoire map now.  */
+		  if (repertoiremap == NULL)
+		    /* This is fatal.  */
+		    error (4, 0,
+			   _("no repertoire map specified: cannot proceed"));
+
+		  repertoire = repertoire_read (repertoiremap);
+		  if (repertoire == NULL)
+		    /* This is also fatal.  */
+		    error (4, errno, _("cannot read repertoire map `%s'"),
+			   repertoiremap);
+		}
 	      state = 50;
 	      break;