about summary refs log tree commit diff
path: root/intl/dcgettext.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-02-19 20:54:38 +0000
committerRoland McGrath <roland@gnu.org>1996-02-19 20:54:38 +0000
commitbe10a86854716071a64f559e1f5bc94e145d0fdb (patch)
treee7abce4d5ba8da4ff17dad3510c4bea6cb3e037e /intl/dcgettext.c
parent1cbca0d93c6c1507c4e69a21e60c77e704b7e1da (diff)
downloadglibc-be10a86854716071a64f559e1f5bc94e145d0fdb.tar.gz
glibc-be10a86854716071a64f559e1f5bc94e145d0fdb.tar.xz
glibc-be10a86854716071a64f559e1f5bc94e145d0fdb.zip
*** empty log message ***
Mon Feb 19 15:30:26 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* stdio-common/tstscanf.c (main): Add check for "0" as %d.

	* sysdeps/stub/msync.c: Undo change of Jan 29; just two args.
	Only some systems have three args; let them define their own stub.

	* sysdeps/generic/dl-sysdep.c: Declare _dl_secure.

	* sysdeps/generic/machine-gmon.h: New file.
	* gmon/Makefile (distribute): Add machine-gmon.h.
	* gmon/mcount.c: Undo changes of Feb 13.
	Include "machine-gmon.h".

Sun Feb 18 13:24:06 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* sysdeps/unix/sysv/linux/direct.h: File removed, since it is
	identical to unix/common/direct.h.

	* sysdeps/unix/Makefile [no_deps]: Don't include s-proto.d.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Don't add ipc.

	* stdio-common/Makefile (tests): Remove scanf6.

	* sysdeps/unix/sysv/linux/Makefile (non-lib.a): Append libieee.a.

	* time/mktime.c (mktime): Move static variable localtime_offset to
	file scope.

	* stdio-common/vfscanf.c: Put '0' in buffer before scanning for %i
	base indicator.

Thu Feb 15 16:56:17 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/m68k/dl-machine.h (elf_machine_load_address): Corrected.
	(ELF_MACHINE_BEFORE_RTLD_RELOC): Define.
	(_dl_runtime_resolve): Save %a1 as well.
	(ELF_MACHINE_RUNTIME_FIXUP_ARGS): Add second dummy arg.
	(elf_machine_relplt): Define.

	* elf/dl-runtime.c: Include possible extra args in declaration of
 	fixup.
Diffstat (limited to 'intl/dcgettext.c')
-rw-r--r--intl/dcgettext.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
index 09e0443494..7562f69ab4 100644
--- a/intl/dcgettext.c
+++ b/intl/dcgettext.c
@@ -1,5 +1,5 @@
-/* dcgettext.c -- implemenatation of the dcgettext(3) function
-   Copyright (C) 1995 Software Foundation, Inc.
+/* dcgettext.c -- implementation of the dcgettext(3) function
+   Copyright (C) 1995 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #ifdef __GNUC__
 # define alloca __builtin_alloca
 #else
-# ifdef HAVE_ALLOCA_H || defined _LIBC
+# if defined HAVE_ALLOCA_H || defined _LIBC
 #  include <alloca.h>
 # else
 #  ifdef _AIX
@@ -151,10 +151,11 @@ const char _nl_default_dirname[] = GNULOCALEDIR;
 struct binding *_nl_domain_bindings;
 
 /* Prototypes for local functions.  */
-static char *find_msg __P ((struct loaded_domain *domain, const char *msgid));
-static const char *category_to_name __P((int category));
-static const char *guess_category_value __P((int category,
-					     const char *categoryname));
+static char *find_msg PARAMS ((struct loaded_domain *domain,
+			       const char *msgid));
+static const char *category_to_name PARAMS ((int category));
+static const char *guess_category_value PARAMS ((int category,
+						 const char *categoryname));
 
 
 /* Names for the libintl functions are a problem.  They must not clash
@@ -182,6 +183,7 @@ DCGETTEXT (domainname, msgid, category)
   char *dirname, *xdomainname;
   char *single_locale;
   char *retval;
+  int saved_errno = errno;
 
   /* If no real MSGID is given return NULL.  */
   if (msgid == NULL)
@@ -233,9 +235,12 @@ DCGETTEXT (domainname, msgid, category)
 	}
 
       if (ret == NULL)
-	/* We cannot get the current working directory.  Don't signal an
-	   error but simply return the default string.  */
-	return (char *) msgid;
+	{
+	  /* We cannot get the current working directory.  Don't signal an
+	     error but simply return the default string.  */
+	  errno = saved_errno;
+	  return (char *) msgid;
+	}
 
       /* We don't want libintl.a to depend on any other library.  So
 	 we avoid the non-standard function stpcpy.  In GNU C Library
@@ -302,7 +307,10 @@ DCGETTEXT (domainname, msgid, category)
 	 domain.  Return the MSGID.  */
       if (strcmp (single_locale, "C") == 0
 	  || strcmp (single_locale, "POSIX") == 0)
-	return (char *) msgid;
+	{
+	  errno = saved_errno;
+	  return (char *) msgid;
+	}
 
 
       /* Find structure describing the message catalog matching the
@@ -317,7 +325,7 @@ DCGETTEXT (domainname, msgid, category)
 	    {
 	      int cnt;
 
-	      for (cnt = 0; domain->successor[cnt] != NULL; --cnt)
+	      for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
 		{
 		  retval = find_msg (domain->successor[cnt], msgid);
 
@@ -327,7 +335,10 @@ DCGETTEXT (domainname, msgid, category)
 	    }
 
 	  if (retval != NULL)
-	    return retval;
+	    {
+	      errno = saved_errno;
+	      return retval;
+	    }
 	}
     }
   /* NOTREACHED */
@@ -375,8 +386,8 @@ find_msg (domain, msgid)
 
       while (1)
 	{
-	  if (idx >= W (domain->must_swap, domain->hash_size) - incr)
-	    idx -= W (domain->must_swap, domain->hash_size) - incr;
+	  if (idx >= domain->hash_size - incr)
+	    idx -= domain->hash_size - incr;
 	  else
 	    idx += incr;