Loading...
stdlib/FreeBSD/strfmon.c.patch Libc-498 Libc-391.4.3
--- Libc/Libc-498/stdlib/FreeBSD/strfmon.c.patch
+++ Libc/Libc-391.4.3/stdlib/FreeBSD/strfmon.c.patch
@@ -1,5 +1,5 @@
 --- strfmon.c.orig	2003-05-20 15:23:25.000000000 -0700
-+++ strfmon.c	2005-04-27 23:34:08.000000000 -0700
++++ strfmon.c	2005-02-27 11:52:19.000000000 -0800
 @@ -28,6 +28,8 @@
  #include <sys/cdefs.h>
  __FBSDID("$FreeBSD: src/lib/libc/stdlib/strfmon.c,v 1.14 2003/03/20 08:18:55 ache Exp $");
@@ -87,19 +87,7 @@
  		}
  
  		/* Conversion Characters */
-@@ -219,8 +218,10 @@
- 
- 		if (flags & USE_INTL_CURRENCY) {
- 			currency_symbol = strdup(lc->int_curr_symbol);
--			if (currency_symbol != NULL)
-+			if (currency_symbol != NULL) {
- 				space_char = *(currency_symbol+3);
-+				currency_symbol[3] = '\0';
-+			}
- 		} else
- 			currency_symbol = strdup(lc->currency_symbol);
- 
-@@ -239,21 +240,21 @@
+@@ -239,21 +238,21 @@
  		/* fill left_prec with amount of padding chars */
  		if (left_prec >= 0) {
  			pad_size = __calc_left_pad((flags ^ IS_NEGATIVE),
@@ -125,35 +113,7 @@
  
  		/*
  		 * Description of some LC_MONETARY's values:
-@@ -313,8 +314,11 @@
- 				} else if (sep_by_space == 1)
- 					PRINT(space_char);
- 			}
--		} else if (sign_posn == 1)
-+		} else if (sign_posn == 1) {
- 			PRINTS(signstr);
-+			if (sep_by_space == 2)
-+				PRINT(' ');
-+		}
- 
- 		PRINTS(asciivalue);
- 
-@@ -348,8 +352,12 @@
- 			PRINTS(signstr);
- 		}
- 
--		if (sign_posn == 0 && (flags & IS_NEGATIVE))
--			PRINT(')');
-+		if (sign_posn == 0) {
-+			if (flags & IS_NEGATIVE)
-+				PRINT(')');
-+			else if (left_prec >= 0)
-+				PRINT(' ');
-+		}
- 
- 		if (dst - tmpptr < width) {
- 			if (flags & LEFT_JUSTIFY) {
-@@ -366,7 +374,6 @@
+@@ -366,7 +365,6 @@
  	}
  
  	PRINT('\0');
@@ -161,7 +121,7 @@
  	free(asciivalue);
  	free(currency_symbol);
  	return (dst - s - 1);	/* return size of put data except trailing '\0' */
-@@ -385,15 +392,12 @@
+@@ -385,15 +383,12 @@
  	if (currency_symbol != NULL)
  		free(currency_symbol);
  	errno = sverrno;
@@ -178,7 +138,7 @@
  
  	if ((flags & IS_NEGATIVE) && (flags & USE_INTL_CURRENCY)) {
  		*cs_precedes = lc->int_n_cs_precedes;
-@@ -429,12 +433,12 @@
+@@ -429,12 +424,12 @@
  }
  
  static int
@@ -193,23 +153,8 @@
  
  	if (cs_precedes != 0) {
  		left_chars += strlen(cur_symb);
-@@ -443,6 +447,10 @@
- 	}
- 
- 	switch (sign_posn) {
-+		case 0:
-+			if (flags & IS_NEGATIVE)
-+				left_chars++;
-+			break;
- 		case 1:
- 			left_chars += strlen(signstr);
- 			break;
-@@ -478,9 +486,11 @@
- }
- 
+@@ -480,7 +475,7 @@
  /* convert double to ASCII */
-+__private_extern__ const char *__fix_nogrouping(const char *);
-+
  static char *
  __format_grouped_double(double value, int *flags,
 -			int left_prec, int right_prec, int pad_char) {
@@ -217,7 +162,7 @@
  
  	char		*rslt;
  	char		*avalue;
-@@ -492,14 +502,13 @@
+@@ -492,7 +487,6 @@
  
  	int		padded;
  
@@ -225,15 +170,7 @@
  	char		*grouping;
  	char		decimal_point;
  	char		thousands_sep;
- 
- 	int groups = 0;
- 
--	grouping = lc->mon_grouping;
-+	grouping = __fix_nogrouping(lc->mon_grouping);
- 	decimal_point = *lc->mon_decimal_point;
- 	if (decimal_point == '\0')
- 		decimal_point = *lc->decimal_point;
-@@ -526,9 +535,9 @@
+@@ -526,9 +520,9 @@
  		left_prec += get_groups(left_prec, grouping);
  
  	/* convert to string */
@@ -245,7 +182,7 @@
  	if (avalue_size < 0)
  		return (NULL);
  
-@@ -601,3 +610,30 @@
+@@ -601,3 +595,30 @@
  	free(avalue);
  	return (rslt);
  }