Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 5 Dec 2003 09:51:08 +0000 (09:51 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 5 Dec 2003 09:51:08 +0000 (09:51 +0000)
2003-11-30  Petter Reinholdtsen  <pere@hungry.com>

* stdlib/strfmon.c: Correct formatting of international currency
values.  The international currency formatting should prefer the
int_* values if they are set for a locale, and use the domestic
values if the int_* values are unset.

23 files changed:
ChangeLog
localedata/ChangeLog
localedata/locales/en_US
localedata/locales/ja_JP
localedata/tst-fmon-locales/tstfmon_n01y12
localedata/tst-fmon-locales/tstfmon_n02n40
localedata/tst-fmon-locales/tstfmon_n10y31
localedata/tst-fmon-locales/tstfmon_n11y41
localedata/tst-fmon-locales/tstfmon_n12y11
localedata/tst-fmon-locales/tstfmon_n20n32
localedata/tst-fmon-locales/tstfmon_n30y20
localedata/tst-fmon-locales/tstfmon_n41n00
localedata/tst-fmon-locales/tstfmon_y01y10
localedata/tst-fmon-locales/tstfmon_y02n22
localedata/tst-fmon-locales/tstfmon_y22n42
localedata/tst-fmon-locales/tstfmon_y30y21
localedata/tst-fmon-locales/tstfmon_y32n31
localedata/tst-fmon-locales/tstfmon_y40y00
localedata/tst-fmon-locales/tstfmon_y42n21
localedata/tst-fmon.c
localedata/tst-fmon.data
localedata/tst-fmon.sh
stdlib/strfmon.c

index b55c08a8083555a2790241a80eb5e66b80452702..85f6ff7fa7cf9b179f8d56e6c9e99fbc2764179d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-11-30  Petter Reinholdtsen  <pere@hungry.com>
+
+       * stdlib/strfmon.c: Correct formatting of international currency
+       values.  The international currency formatting should prefer the
+       int_* values if they are set for a locale, and use the domestic
+       values if the int_* values are unset.
+
 2003-12-03  Jakub Jelinek  <jakub@redhat.com>
 
        * posix/Makefile (distribute): Add BOOST.tests.
index 1b4802c8294245cb8ff1a9c6da407b140724a2d0..62c79ff13989a37a4e480c68f65be21b2c3d41e0 100644 (file)
@@ -1,3 +1,35 @@
+2003-11-30  Petter Reinholdtsen  <pere@hungry.com>
+
+       * tst-fmon.sh: Allow quotes around the result string, to make it
+       easier to see important whitespace.
+       * tst-fmon.data: Likewise.
+
+       * tst-fmon.sh: Clean up output, unify capitalization and output order.
+       * tst-fmon.c: Likewise.
+
+       * tst-fmon.data: Add test for international currency formatting.
+       * tst-fmon-locales/tstfmon_n01y12: Add definitions for int_* fields.
+       * tst-fmon-locales/tstfmon_n02n40: Likewise.
+       * tst-fmon-locales/tstfmon_n10y31: Likewise.
+       * tst-fmon-locales/tstfmon_n11y41: Likewise.
+       * tst-fmon-locales/tstfmon_n12y11: Likewise.
+       * tst-fmon-locales/tstfmon_n20n32: Likewise.
+       * tst-fmon-locales/tstfmon_n30y20: Likewise.
+       * tst-fmon-locales/tstfmon_n41n00: Likewise.
+       * tst-fmon-locales/tstfmon_y01y10: Likewise.
+       * tst-fmon-locales/tstfmon_y02n22: Likewise.
+       * tst-fmon-locales/tstfmon_y22n42: Likewise.
+       * tst-fmon-locales/tstfmon_y30y21: Likewise.
+       * tst-fmon-locales/tstfmon_y32n31: Likewise.
+       * tst-fmon-locales/tstfmon_y40y00: Likewise.
+       * tst-fmon-locales/tstfmon_y42n21: Likewise.
+
+       * locales/en_US: Correct spacing for international
+       currency formatting, now that strfmon() works better.
+
+       * locales/ja_JP: Correct currency position and
+       spacing now that strfmon() work better.
+
 2003-12-03  Ulrich Drepper  <drepper@redhat.com>
 
        * locales/af_ZA: Add ISO 3166 information.
index 13a19dba212b058b8801996e51785035be984557..1da3158cd705d160ea24674da76f8688ab0230b6 100644 (file)
@@ -52,8 +52,10 @@ negative_sign       "<U002D>"
 int_frac_digits     2
 frac_digits         2
 p_cs_precedes       1
+int_p_sep_by_space  1
 p_sep_by_space      0
 n_cs_precedes       1
+int_n_sep_by_space  1
 n_sep_by_space      0
 p_sign_posn         1
 n_sign_posn         1
index 1e4b1c188ef6a31736970d06dab841f59c09b7ae..6a3229f9aa6ededff3f22ae8cb991a43e86d2fbc 100644 (file)
@@ -14894,8 +14894,10 @@ p_cs_precedes          1
 p_sep_by_space         0
 n_cs_precedes          1
 n_sep_by_space         0
-p_sign_posn            1
+p_sign_posn            4
 n_sign_posn            4
+int_p_sep_by_space     2
+int_n_sep_by_space     2
 END LC_MONETARY
 
 
index 975c5ec9a5e4a03cdb592ab708e4f485ee2e5c0a..499a1ea28e029d410030c8cb6de06f8636ee593b 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          1
 n_cs_precedes           1
 n_sign_posn             1
 n_sep_by_space          2
+int_p_cs_precedes       0
+int_p_sign_posn         0
+int_p_sep_by_space      1
+int_n_cs_precedes       1
+int_n_sign_posn         1
+int_n_sep_by_space      2
 END LC_MONETARY
index 7c4161243f94d71e5f5680e03f6fbbbad05653f1..ad6ee6b1cad7f5157c6b7f5206b7ebc7953b42be 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          2
 n_cs_precedes           0
 n_sign_posn             4
 n_sep_by_space          0
+int_p_cs_precedes       0
+int_p_sign_posn         0
+int_p_sep_by_space      2
+int_n_cs_precedes       0
+int_n_sign_posn         4
+int_n_sep_by_space      0
 END LC_MONETARY
index 5e14d7dcfdf7f0e54e52c16d121aeb9cbb2a5671..e325832e346cd917f3951df3c5244433ff1ecc7f 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          0
 n_cs_precedes           1
 n_sign_posn             3
 n_sep_by_space          1
+int_p_cs_precedes       0
+int_p_sign_posn         1
+int_p_sep_by_space      0
+int_n_cs_precedes       1
+int_n_sign_posn         3
+int_n_sep_by_space      1
 END LC_MONETARY
index 22685cb83ef16c0181fda3c33dc8b67054aa42f0..497f750a00840aa41eb12e8db0d15e12be95a80a 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          1
 n_cs_precedes           1
 n_sign_posn             4
 n_sep_by_space          1
+int_p_cs_precedes       0
+int_p_sign_posn         1
+int_p_sep_by_space      1
+int_n_cs_precedes       1
+int_n_sign_posn         4
+int_n_sep_by_space      1
 END LC_MONETARY
index 0788bab471e54cf76c603a5873d084dcd39e671b..d964101df5aea79b67e7497ca979b2121ba8a742 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          2
 n_cs_precedes           1
 n_sign_posn             1
 n_sep_by_space          1
+int_p_cs_precedes       0
+int_p_sign_posn         1
+int_p_sep_by_space      2
+int_n_cs_precedes       1
+int_n_sign_posn         1
+int_n_sep_by_space      1
 END LC_MONETARY
index 2c219e9d42508eb0288daa6bc12faefeb42efe0b..94412809ffdce1e77b3d88b556f705b1faa756d8 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          0
 n_cs_precedes           0
 n_sign_posn             3
 n_sep_by_space          2
+int_p_cs_precedes       0
+int_p_sign_posn         2
+int_p_sep_by_space      0
+int_n_cs_precedes       0
+int_n_sign_posn         3
+int_n_sep_by_space      2
 END LC_MONETARY
index c3216b4e2d8b071d1e1dbb06dcf59b2d86268ee1..2c8a9ea7a0434369de4ed11601405d32fc47455d 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          0
 n_cs_precedes           1
 n_sign_posn             2
 n_sep_by_space          0
+int_p_cs_precedes       0
+int_p_sign_posn         3
+int_p_sep_by_space      0
+int_n_cs_precedes       1
+int_n_sign_posn         2
+int_n_sep_by_space      0
 END LC_MONETARY
index 199cd54cf81767a975cd4f17b3b98917bf4ab2a5..56879ec9c18bf21b3c6683daae080c4c786b86bc 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          1
 n_cs_precedes           0
 n_sign_posn             0
 n_sep_by_space          0
+int_p_cs_precedes       0
+int_p_sign_posn         4
+int_p_sep_by_space      1
+int_n_cs_precedes       0
+int_n_sign_posn         0
+int_n_sep_by_space      0
 END LC_MONETARY
index 1e26360b912a07a9ae1a759f5c707021ea4aaf9b..7c0b22afca263d2ca2e05b4c2cd9fac1b953b313 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          1
 n_cs_precedes           1
 n_sign_posn             1
 n_sep_by_space          0
+int_p_cs_precedes       1
+int_p_sign_posn         0
+int_p_sep_by_space      1
+int_n_cs_precedes       1
+int_n_sign_posn         1
+int_n_sep_by_space      0
 END LC_MONETARY
index 26c8158d216e33df242a2b27438f0f013ef6bcd6..7d9ac30104ed2cff825d4797e42dd2512b2b4ae6 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          2
 n_cs_precedes           0
 n_sign_posn             2
 n_sep_by_space          2
+int_p_cs_precedes       1
+int_p_sign_posn         0
+int_p_sep_by_space      2
+int_n_cs_precedes       0
+int_n_sign_posn         2
+int_n_sep_by_space      2
 END LC_MONETARY
index 37a2d49f0034edcb011f5750bd637597e633ff44..fda413b0e6251b51960d585f973506dd870656ef 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          2
 n_cs_precedes           0
 n_sign_posn             4
 n_sep_by_space          2
+int_p_cs_precedes       1
+int_p_sign_posn         2
+int_p_sep_by_space      2
+int_n_cs_precedes       0
+int_n_sign_posn         4
+int_n_sep_by_space      2
 END LC_MONETARY
index 4b38c4252c60ef208e489f995538ece98089137c..9dee2cc16b2433fa23f1b593062b6336655e0265 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          0
 n_cs_precedes           1
 n_sign_posn             2
 n_sep_by_space          1
+int_p_cs_precedes       1
+int_p_sign_posn         3
+int_p_sep_by_space      0
+int_n_cs_precedes       1
+int_n_sign_posn         2
+int_n_sep_by_space      1
 END LC_MONETARY
index 7c541546079d0b4ae62e7ad9f87b4b537e110ecb..34967c778bcfe8762dfc03eda469656e97785133 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          2
 n_cs_precedes           0
 n_sign_posn             3
 n_sep_by_space          1
+int_p_cs_precedes       1
+int_p_sign_posn         3
+int_p_sep_by_space      2
+int_n_cs_precedes       0
+int_n_sign_posn         3
+int_n_sep_by_space      1
 END LC_MONETARY
index 664b20db59cf402fd7bd6165d292f6989192d8ec..348b07b1e63ddd9442829d33bd4bbd55d94de6e8 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          0
 n_cs_precedes           1
 n_sign_posn             0
 n_sep_by_space          0
+int_p_cs_precedes       1
+int_p_sign_posn         4
+int_p_sep_by_space      0
+int_n_cs_precedes       1
+int_n_sign_posn         0
+int_n_sep_by_space      0
 END LC_MONETARY
index 2a879e4f7291984f90c0df72e36c4bbf84b97836..d2f7e9ed44f8101ec7294d71c162a76026368ac2 100644 (file)
@@ -23,4 +23,10 @@ p_sep_by_space          2
 n_cs_precedes           0
 n_sign_posn             2
 n_sep_by_space          1
+int_p_cs_precedes       1
+int_p_sign_posn         4
+int_p_sep_by_space      2
+int_n_cs_precedes       0
+int_n_sign_posn         2
+int_n_sep_by_space      1
 END LC_MONETARY
index 091a057a0f559bc28085aa0584f4018efce4a34b..a45c8ba1667a309c955b3e03bf16ef71c523ee1c 100644 (file)
@@ -58,8 +58,8 @@ main (int argc, char *argv[])
   if (strcmp (s, argv[4]) != 0)
     {
       printf ("\
-locale: \"%s\", format: \"%s\", expected: \"%s\", got: \"%s\" => %s\n",
-             argv[1], argv[2], argv[4], s,
+Locale: \"%s\" Format: \"%s\" Value: \"%s\" Recieved: \"%s\" Expected: \"%s\" => %s\n",
+             argv[1], argv[2], argv[3], s, argv[4],
              strcmp (s, argv[4]) != 0 ? "false" : "correct");
       exit (EXIT_FAILURE);
     }
index d67a38f54b55ba36e2d733946e9fe469e42dec12..d7bcb1793f4960bab6cd8a110cc71010a0950162 100644 (file)
@@ -1,5 +1,5 @@
 # Test data for test-strfmon, which checks it's implementation in glibc
-# Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Jochen Hein <jochen.hein@delphi.central.de>, 1997.
 #
@@ -28,6 +28,8 @@
 # #2    format string which is fed into strfmon
 # #3    double value that is used for formatting
 # #4    the expected result (may contain trailing spaces!)
+#       This field might be enclosed with "" to make it easier to see
+#       the white space
 #
 # First the implementation without any locale-dependent data
 # - no currency symbol is printed, formatting is somewhat standard
@@ -236,3 +238,113 @@ tstfmon_y42n21            %11n    123.45            $ +123.45
 tstfmon_y42n21         %11n    -123.45           123.45 $-
 tstfmon_y42n21         %^=*#5n 123.45          $ +**123.45
 tstfmon_y42n21         %^=*#5n -123.45            **123.45 $-
+#
+# check all int_cs_precedes/int_sign_posn/int_sep_by_space
+# combinations using special test locales.  The six characters after
+# the "_" indicate these three values for positive and then negative
+# quantities.
+#
+tstfmon_n01y12         %i      123.45          "123.45 USC"
+tstfmon_n01y12         %i      -123.45         "- USC123.45"
+tstfmon_n01y12         %13i    123.45          "   123.45 USC"
+tstfmon_n01y12         %13i    -123.45         "  - USC123.45"
+tstfmon_n01y12         %^=*#5i 123.45          "     **123.45 USC"
+tstfmon_n01y12         %^=*#5i -123.45         "- USC**123.45"
+#
+tstfmon_n02n40         %i      123.45          "123.45USC"
+tstfmon_n02n40         %i      -123.45         "123.45USC-"
+tstfmon_n02n40         %13i    123.45          "    123.45USC"
+tstfmon_n02n40         %13i    -123.45         "   123.45USC-"
+tstfmon_n02n40         %^=*#5i 123.45          "**123.45USC"
+tstfmon_n02n40         %^=*#5i -123.45         "**123.45USC-"
+#
+tstfmon_n10y31         %i      123.45          "+123.45USC"
+tstfmon_n10y31         %i      -123.45         "-USC 123.45"
+tstfmon_n10y31         %13i    123.45          "   +123.45USC"
+tstfmon_n10y31         %13i    -123.45         "  -USC 123.45"
+tstfmon_n10y31         %^=*#5i 123.45          "    +**123.45USC"
+tstfmon_n10y31         %^=*#5i -123.45         "-USC **123.45"
+#
+tstfmon_n11y41         %i      123.45          "+123.45 USC"
+tstfmon_n11y41         %i      -123.45         "USC- 123.45"
+tstfmon_n11y41         %13i    123.45          "  +123.45 USC"
+tstfmon_n11y41         %13i    -123.45         "  USC- 123.45"
+tstfmon_n11y41         %^=*#5i 123.45          "    +**123.45 USC"
+tstfmon_n11y41         %^=*#5i -123.45         "USC- **123.45"
+#
+tstfmon_n12y11         %i      123.45          "+123.45USC"
+tstfmon_n12y11         %i      -123.45         "-USC 123.45"
+tstfmon_n12y11         %13i    123.45          "   +123.45USC"
+tstfmon_n12y11         %13i    -123.45         "  -USC 123.45"
+tstfmon_n12y11         %^=*#5i 123.45          "    +**123.45USC"
+tstfmon_n12y11         %^=*#5i -123.45         "-USC **123.45"
+#
+tstfmon_n20n32         %i      123.45          "123.45USC+"
+tstfmon_n20n32         %i      -123.45         "123.45- USC"
+tstfmon_n20n32         %13i    123.45          "   123.45USC+"
+tstfmon_n20n32         %13i    -123.45         "  123.45- USC"
+tstfmon_n20n32         %^=*#5i 123.45          "**123.45USC+"
+tstfmon_n20n32         %^=*#5i -123.45         "**123.45- USC"
+#
+tstfmon_n30y20         %i      123.45          "123.45+USC"
+tstfmon_n30y20         %i      -123.45         "USC123.45-"
+tstfmon_n30y20         %13i    123.45          "   123.45+USC"
+tstfmon_n30y20         %13i    -123.45         "   USC123.45-"
+tstfmon_n30y20         %^=*#5i 123.45          "   **123.45+USC"
+tstfmon_n30y20         %^=*#5i -123.45         "USC**123.45-"
+#
+tstfmon_n41n00         %i      123.45          "123.45 USC+"
+tstfmon_n41n00         %i      -123.45         "(123.45USC)"
+tstfmon_n41n00         %13i    123.45          "  123.45 USC+"
+tstfmon_n41n00         %13i    -123.45         "  (123.45USC)"
+tstfmon_n41n00         %^=*#5i 123.45          " **123.45 USC+"
+tstfmon_n41n00         %^=*#5i -123.45         "(**123.45USC)"
+#
+tstfmon_y01y10         %i      123.45          "USC 123.45"
+tstfmon_y01y10         %i      -123.45         "-USC123.45"
+tstfmon_y01y10         %13i    123.45          "   USC 123.45"
+tstfmon_y01y10         %13i    -123.45         "   -USC123.45"
+tstfmon_y01y10         %^=*#5i 123.45          "USC **123.45"
+tstfmon_y01y10         %^=*#5i -123.45         "-USC**123.45"
+#
+tstfmon_y02n22         %i      123.45          "USC123.45"
+tstfmon_y02n22         %i      -123.45         "123.45USC O/D"
+tstfmon_y02n22         %12i    123.45          "   USC123.45"
+tstfmon_y02n22         %12i    -123.45         "123.45USC O/D"
+tstfmon_y02n22         %^=*#5i 123.45          "USC**123.45"
+tstfmon_y02n22         %^=*#5i -123.45         "   **123.45USC O/D"
+#
+tstfmon_y22n42         %i      123.45          "USC123.45+"
+tstfmon_y22n42         %i      -123.45         "123.45USC -"
+tstfmon_y22n42         %13i    123.45          "   USC123.45+"
+tstfmon_y22n42         %13i    -123.45         "  123.45USC -"
+tstfmon_y22n42         %^=*#5i 123.45          "USC**123.45+"
+tstfmon_y22n42         %^=*#5i -123.45         "   **123.45USC -"
+#
+tstfmon_y30y21         %i      123.45          "+USC123.45"
+tstfmon_y30y21         %i      -123.45         "USC 123.45-"
+tstfmon_y30y21         %13i    123.45          "   +USC123.45"
+tstfmon_y30y21         %13i    -123.45         "  USC 123.45-"
+tstfmon_y30y21         %^=*#5i 123.45          "+USC**123.45"
+tstfmon_y30y21         %^=*#5i -123.45         "USC **123.45-"
+#
+tstfmon_y32n31         %i      123.45          "+ USC123.45"
+tstfmon_y32n31         %i      -123.45         "123.45 -USC"
+tstfmon_y32n31         %13i    123.45          "  + USC123.45"
+tstfmon_y32n31         %13i    -123.45         "  123.45 -USC"
+tstfmon_y32n31         %^=*#5i 123.45          "+ USC**123.45"
+tstfmon_y32n31         %^=*#5i -123.45         "     **123.45 -USC"
+#
+tstfmon_y40y00         %i      123.45          "USC+123.45"
+tstfmon_y40y00         %i      -123.45         "(USC123.45)"
+tstfmon_y40y00         %13i    123.45          "   USC+123.45"
+tstfmon_y40y00         %13i    -123.45         "  (USC123.45)"
+tstfmon_y40y00         %^=*#5i 123.45          "USC+**123.45"
+tstfmon_y40y00         %^=*#5i -123.45         "(USC**123.45)"
+#
+tstfmon_y42n21         %i      123.45          "USC +123.45"
+tstfmon_y42n21         %i      -123.45         "123.45 USC-"
+tstfmon_y42n21         %13i    123.45          "  USC +123.45"
+tstfmon_y42n21         %13i    -123.45         "  123.45 USC-"
+tstfmon_y42n21         %^=*#5i 123.45          "USC +**123.45"
+tstfmon_y42n21         %^=*#5i -123.45         "     **123.45 USC-"
index c8b6d69949b5fb8a80891772550ba366d53b2e0e..95dab36f74baf53932e1de451a607bc9ee1cb07c 100755 (executable)
@@ -44,16 +44,17 @@ errcode=0
 while IFS="    " read locale format value expect; do
     case "$locale" in '#'*) continue ;; esac
     if [ -n "$format" ]; then
+       expect=`echo "$expect" | sed 's/^\"\(.*\)\"$/\1/'`
        if LOCPATH=${common_objpfx}localedata \
           GCONV_PATH=${common_objpfx}/iconvdata \
           ${run_program_prefix} ${common_objpfx}localedata/tst-fmon \
           "$locale" "$format" "$value" "$expect" ; then
            echo "Locale: \"${locale}\" Format: \"${format}\"" \
-                "Value: \"${value}\" Expect: \"${expect}\"  passed"
+                "Value: \"${value}\" Expected: \"${expect}\"  passed"
        else
            errcode=$?
            echo "Locale: \"${locale}\" Format: \"${format}\"" \
-                "Value: \"${value}\" Expect: \"${expect}\"    failed"
+                "Value: \"${value}\" Expected: \"${expect}\"    failed"
        fi
     fi
 done < $datafile
index e7183ec843a72eb2eb1bc680afcf87fba9b624ee..4f163165421a735aabb3bda333300dbf295713a7 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatting a monetary value according to the current locale.
-   Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>
    and Jochen Hein <Jochen.Hein@informatik.TU-Clausthal.de>, 1996.
@@ -128,6 +128,7 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
        __long_double_t ldbl;
       }
       fpnum;
+      int int_format;
       int print_curr_symbol;
       int left_prec;
       int left_pad;
@@ -172,6 +173,7 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
        }
 
       /* Defaults for formatting.  */
+      int_format = 0;                  /* Use international curr. symbol */
       print_curr_symbol = 1;           /* Print the currency symbol.  */
       left_prec = -1;                  /* No left precision specified.  */
       right_prec = -1;                 /* No right precision specified.  */
@@ -233,13 +235,6 @@ __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.  */
@@ -305,31 +300,27 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
        }
 
       /* Handle format specifier.  */
+      char int_symbol[4];
       switch (*fmt++)
        {
-       case 'i':               /* Use international currency symbol.  */
-         currency_symbol = _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL);
+       case 'i': {             /* Use international currency symbol.  */
+         const char *int_curr_symbol;
+
+         int_curr_symbol = _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL);
+         strncpy(int_symbol, int_curr_symbol, 3);
+         int_symbol[3] = '\0';
+
          currency_symbol_len = 3;
-         space_char = currency_symbol[3];
-         if (right_prec == -1)
-           {
-             if (*_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS) == CHAR_MAX)
-               right_prec = 2;
-             else
-               right_prec = *_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS);
-           }
+         currency_symbol = &int_symbol[0];
+         space_char = int_curr_symbol[3];
+         int_format = 1;
          break;
+       }
        case 'n':               /* Use national currency symbol.  */
          currency_symbol = _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL);
          currency_symbol_len = strlen (currency_symbol);
          space_char = ' ';
-         if (right_prec == -1)
-           {
-             if (*_NL_CURRENT (LC_MONETARY, FRAC_DIGITS) == CHAR_MAX)
-               right_prec = 2;
-             else
-               right_prec = *_NL_CURRENT (LC_MONETARY, FRAC_DIGITS);
-           }
+         int_format = 0;
          break;
        default:                /* Any unrecognized format is an error.  */
          __set_errno (EINVAL);
@@ -337,6 +328,21 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
          return -1;
        }
 
+      /* 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, int_format ? INT_P_SIGN_POSN : P_SIGN_POSN);
+      if (n_sign_posn == -1)
+       n_sign_posn = *_NL_CURRENT (LC_MONETARY, int_format ? INT_N_SIGN_POSN : N_SIGN_POSN);
+
+      if (right_prec == -1)
+       {
+         right_prec = *_NL_CURRENT (LC_MONETARY, int_format ? INT_FRAC_DIGITS : FRAC_DIGITS);
+
+         if (right_prec == CHAR_MAX)
+           right_prec = 2;
+       }
+
       /* If we have to print the digits grouped determine how many
         extra characters this means.  */
       if (group && left_prec != -1)
@@ -369,27 +375,27 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
             negative sign we use a '-'.  */
          if (*sign_string == '\0')
            sign_string = (const char *) "-";
-         cs_precedes = *_NL_CURRENT (LC_MONETARY, N_CS_PRECEDES);
-         sep_by_space = *_NL_CURRENT (LC_MONETARY, N_SEP_BY_SPACE);
+         cs_precedes = *_NL_CURRENT (LC_MONETARY, int_format ? INT_N_CS_PRECEDES : N_CS_PRECEDES);
+         sep_by_space = *_NL_CURRENT (LC_MONETARY, int_format ? INT_N_SEP_BY_SPACE : N_SEP_BY_SPACE);
          sign_posn = n_sign_posn;
 
          other_sign_string = _NL_CURRENT (LC_MONETARY, POSITIVE_SIGN);
-         other_cs_precedes = *_NL_CURRENT (LC_MONETARY, P_CS_PRECEDES);
-         other_sep_by_space = *_NL_CURRENT (LC_MONETARY, P_SEP_BY_SPACE);
+         other_cs_precedes = *_NL_CURRENT (LC_MONETARY, int_format ? INT_P_CS_PRECEDES : P_CS_PRECEDES);
+         other_sep_by_space = *_NL_CURRENT (LC_MONETARY, int_format ? INT_P_SEP_BY_SPACE : P_SEP_BY_SPACE);
          other_sign_posn = p_sign_posn;
        }
       else
        {
          sign_string = _NL_CURRENT (LC_MONETARY, POSITIVE_SIGN);
-         cs_precedes = *_NL_CURRENT (LC_MONETARY, P_CS_PRECEDES);
-         sep_by_space = *_NL_CURRENT (LC_MONETARY, P_SEP_BY_SPACE);
+         cs_precedes = *_NL_CURRENT (LC_MONETARY, int_format ? INT_P_CS_PRECEDES : P_CS_PRECEDES);
+         sep_by_space = *_NL_CURRENT (LC_MONETARY, int_format ? INT_P_SEP_BY_SPACE : P_SEP_BY_SPACE);
          sign_posn = p_sign_posn;
 
          other_sign_string = _NL_CURRENT (LC_MONETARY, NEGATIVE_SIGN);
          if (*other_sign_string == '\0')
            other_sign_string = (const char *) "-";
-         other_cs_precedes = *_NL_CURRENT (LC_MONETARY, N_CS_PRECEDES);
-         other_sep_by_space = *_NL_CURRENT (LC_MONETARY, N_SEP_BY_SPACE);
+         other_cs_precedes = *_NL_CURRENT (LC_MONETARY, int_format ? INT_N_CS_PRECEDES : N_CS_PRECEDES);
+         other_sep_by_space = *_NL_CURRENT (LC_MONETARY, int_format ? INT_N_SEP_BY_SPACE : N_SEP_BY_SPACE);
          other_sign_posn = n_sign_posn;
        }