about summary refs log tree commit diff
path: root/stdlib/strfmon.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-11-04 03:00:40 +0000
committerUlrich Drepper <drepper@redhat.com>1997-11-04 03:00:40 +0000
commit1618c590382ef16b1942bf39a42aa683a050ff57 (patch)
treee36cbd52b4f65aa04764417892264eac7757e6eb /stdlib/strfmon.c
parent1cab5444231a4a1fab9c3abb107d22af4eb09327 (diff)
downloadglibc-1618c590382ef16b1942bf39a42aa683a050ff57.tar.gz
glibc-1618c590382ef16b1942bf39a42aa683a050ff57.tar.xz
glibc-1618c590382ef16b1942bf39a42aa683a050ff57.zip
1997-11-04  Ulrich Drepper  <drepper@cygnus.com>

	* manual/filesys.texi: Correct description of return value for
	readdir_r.
	* sysdeps/unix/readdir_r.c (__readdir_r): Return value of errno
	not -1 in error case.
	* sysdeps/generic/readdir_r.c (__readdir_r): Return ENOSYS not -1.
	Reported by Jim Meyering <meyering@eng.ascend.com>.

1997-11-02  Paul Eggert  <eggert@twinsun.com>

	* strftime.c: Use host's underlying strftime to access
	locale-specific info.  This is useful e.g. when building GNU
	Emacs under Solaris 2.6.
	(weekday_name, month_name): Omit if HAVE_STRFTIME.
	(my_strftime): New macro, which names the strftime function that
	this source file produces.
	(strftime): #undef if emacs is defined; this works around Emacs 20.2's
	method of compiling with -Dstrftime=emacs_strftime.
	Also, declare as a function returning size_t, for similar reasons.
	(my_strftime): If HAVE_STRFTIME, use underlying strftime to handle
	locale-dependent formats like %a and %Ec.

1997-11-02  Paul Eggert  <eggert@twinsun.com>

	* strftime.c (memcpy_lowcase, memcpy_uppcase, strftime):
	Ensure that args to islower and isupper are valid unsigned
	chars, even if char is signed.

1997-11-04  Ulrich Drepper  <drepper@cygnus.com>

	* assert/Makefile (headers): Add assert.h, necessary after patch
	to Makefiles.
	* ctype/Makefile (headers): Likewise.
	* pwd/Makefile (headers): Likewise.
	* grp/Makefile (headers): Likewise.
	Patch by NIIBE Yutaka <gniibe@mri.co.jp>.

1997-11-04 03:08  Ulrich Drepper  <drepper@cygnus.com>

	* glibcbug.in: Add information about configured target.
	Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.

	* elf/dl-lookup.c (_dl_lookup_versioned_symbol): Be prepared for
	empty string as `reference_name' parameter.
	* elf/rtld.c: Don't set real program name in l_name of main object.

	* manual/creature.texi: Apply Paul Eggert's patch for better
	_POSIX_C_SOURCE description.

	* stdlib/strfmon.c: Fix numerous bugs in formatting.

	* time/strptime.c [%Y]: Treat all years, not only those which fit
	in time_t.
	[%Oy]: Really store value.
	Patches by Paul Eggert.

	* wcsmbs/wchar.h: Fix documentation bugs.  Declare wcsdup only
	is __USE_GNU.

1997-11-03 02:48  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/bits/errno.h: Remove all error definitions.  This
	is only meant as a stub.

1997-10-31  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* sysdeps/standalone/bits/errno.h: Copied from
	sysdeps/generic/bits/errno.h and added all know error codes that
	are used in glibc.

1997-11-03 02:23  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/make_siglist.c: Add comment to clarify use and
	make sure the correct _NSIG value is used.
	Patch by Klaus Espenlaub <kespenla@student.informatik.uni-ulm.de>.

1997-11-03 00:20  Ulrich Drepper  <drepper@cygnus.com>

	* intl/localealias.c (read_alias_file): Correct handling of line
	reader which sometimes skipped complete lines (PR 205).
	Optimize a bit by using mempcpy.

1997-11-02 16:59  Philipp Thomas  <kthomas@gwdg.de>

	* intl/localealias.c (read_alias_file): Correctly set map[].value
	instead of overwriting map[].alias

1997-11-02 15:32  Ulrich Drepper  <drepper@cygnus.com>

	* libc.map: Add _IO_flockfile and _IO_funlockfile.
	Suggested by H.J. Lu <hjl@lucon.org>.

1997-11-02 15:17  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-error.c (_dl_signal_error): Use _strerror_internal instead
	of strerror.
	* assert/assert-perr.c: Use _strerror_internal directly instead of
	__strerror_r.
	Suggested by Joe Keane <jgk@jgk.org>.

1997-11-01 16:46  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* configure.in: Check for gcc-2.7.2 -pipe bug and hack around it
	(PR 245).

1997-11-01  Paul Eggert  <eggert@twinsun.com>

	* time/strptime.c (strptime_internal): Fix bug: %Oy forgot to
	assign tm_year.  Do not restrict %Y to years less than 2037 even
	on 32-bit time_t hosts, as strptime returns an int tm_year, not a
	time_t, and it's possible for programs to use the year without
	having to use time_t.

	non-directories in the list (PR 203).
Diffstat (limited to 'stdlib/strfmon.c')
-rw-r--r--stdlib/strfmon.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c
index c956ae3040..4f8b5b70af 100644
--- a/stdlib/strfmon.c
+++ b/stdlib/strfmon.c
@@ -204,7 +204,8 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
 		  va_end (ap);
 		  return -1;
 		}
-	      n_sign_posn = 5;	/* This is a else unused value.  */
+	      p_sign_posn = 0;
+	      n_sign_posn = 0;
 	      continue;
 	    case '!':			/* Don't print the currency symbol.  */
 	      print_curr_symbol = 0;
@@ -218,6 +219,13 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
 	  break;
 	}
 
+      /* If not specified by the format string now find the values for
+	 the format specification.  */
+      if (p_sign_posn == -1)
+	p_sign_posn = *_NL_CURRENT (LC_MONETARY, P_SIGN_POSN);
+      if (n_sign_posn == -1)
+	n_sign_posn = *_NL_CURRENT (LC_MONETARY, N_SIGN_POSN);
+
       if (isdigit (*fmt))
 	{
 	  /* Parse field width.  */
@@ -341,13 +349,7 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
 	    sign_char = '-';
 	  cs_precedes = *_NL_CURRENT (LC_MONETARY, N_CS_PRECEDES);
 	  sep_by_space = *_NL_CURRENT (LC_MONETARY, N_SEP_BY_SPACE);
-	  /* If the '(' flag is not given use the sign position from
-	     the current locale.  */
-	  if (n_sign_posn == -1)
-	    sign_posn = *_NL_CURRENT (LC_MONETARY, N_SIGN_POSN);
-	  else
-	    /* This means use parentheses.  */
-	    sign_posn = 0;
+	  sign_posn = n_sign_posn;
 	}
       else
 	{
@@ -358,13 +360,7 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
 	    sign_char = ' ';
 	  cs_precedes = *_NL_CURRENT (LC_MONETARY, P_CS_PRECEDES);
 	  sep_by_space = *_NL_CURRENT (LC_MONETARY, P_SEP_BY_SPACE);
-	  if (n_sign_posn == -1)
-	    sign_posn = *_NL_CURRENT (LC_MONETARY, P_SIGN_POSN);
-	  else
-	    /* Here we don't set SIGN_POSN to 0 because we don'want to
-	       print <SP> instead of the braces and this is what the
-	       value 5 means.  */
-	    sign_posn = 5;
+	  sign_posn = p_sign_posn;
 	}
 
       /* Set default values for unspecified information.  */
@@ -384,9 +380,7 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
       startp = dest;		/* Remember start so we can compute length.  */
 
       if (sign_posn == 0)
-	out_char (left_paren);
-      if (sign_posn == 5)	/* This is for positive number and ( flag.  */
-	out_char (' ');
+	out_char (is_negative ? left_paren : ' ');
 
       if (cs_precedes)
 	{
@@ -495,9 +489,7 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
 	  }
 
       if (sign_posn == 0)
-	out_char (right_paren);
-      if (sign_posn == 5)
-	out_char (' ');		/* This is for positive number and ( flag.  */
+	out_char (is_negative ? right_paren : ' ');
 
       /* Now test whether the output width is filled.  */
       if (dest - startp < width)