about summary refs log tree commit diff
path: root/wcsmbs
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/mbrtowc.c5
-rw-r--r--wcsmbs/mbsinit.c3
-rw-r--r--wcsmbs/mbsrtowcs.c6
-rw-r--r--wcsmbs/wcrtomb.c10
-rw-r--r--wcsmbs/wcsrtombs.c5
5 files changed, 26 insertions, 3 deletions
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index 17083196bd..2c4b0779da 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -20,6 +20,8 @@ Boston, MA 02111-1307, USA.  */
 #include <wchar.h>
 
 
+static mbstate_t internal;
+
 size_t
 mbrtowc (pwc, s, n, ps)
      wchar_t *pwc;
@@ -29,6 +31,9 @@ mbrtowc (pwc, s, n, ps)
 {
   wchar_t to_wide;
 
+  if (ps == NULL)
+    ps = &internal;
+
   /*************************************************************\
   |* This is no complete implementation.  While the multi-byte *|
   |* character handling is not finished this will do.	       *|
diff --git a/wcsmbs/mbsinit.c b/wcsmbs/mbsinit.c
index d9f01256d5..efbfd09347 100644
--- a/wcsmbs/mbsinit.c
+++ b/wcsmbs/mbsinit.c
@@ -17,6 +17,7 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+#include <string.h>
 #include <wchar.h>
 
 
@@ -29,5 +30,5 @@ mbsinit (ps)
   |* character handling is not finished this will do.	       *|
   \*************************************************************/
 
-  return *ps == 0;
+  return ps == NULL || *ps == 0;
 }
diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c
index cb87938e5d..dc026b7252 100644
--- a/wcsmbs/mbsrtowcs.c
+++ b/wcsmbs/mbsrtowcs.c
@@ -20,6 +20,8 @@ Boston, MA 02111-1307, USA.  */
 #include <wchar.h>
 
 
+static mbstate_t internal;
+
 size_t
 mbsrtowcs (dst, src, len, ps)
      wchar_t *dst;
@@ -28,6 +30,10 @@ mbsrtowcs (dst, src, len, ps)
      mbstate_t *ps;
 {
   size_t result = 0;
+
+  if (ps == NULL)
+    ps = &internal;
+
   /*************************************************************\
   |* This is no complete implementation.  While the multi-byte *|
   |* character handling is not finished this will do.	       *|
diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c
index 43a2162500..2703e88a36 100644
--- a/wcsmbs/wcrtomb.c
+++ b/wcsmbs/wcrtomb.c
@@ -24,19 +24,25 @@ Boston, MA 02111-1307, USA.  */
 #define EILSEQ EINVAL
 #endif
 
+
+static mbstate_t internal;
+
 size_t
 wcrtomb (s, wc, ps)
      char *s;
      wchar_t wc;
      mbstate_t *ps;
 {
+  char fake[1];
+
+  if (ps == NULL)
+    ps = internal;
+
   /*************************************************************\
   |* This is no complete implementation.  While the multi-byte *|
   |* character handling is not finished this will do.	       *|
   \*************************************************************/
 
-  char fake[1];
-
   if (s == NULL)
     {
       s = fake;
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c
index 487237fcad..9f1000937b 100644
--- a/wcsmbs/wcsrtombs.c
+++ b/wcsmbs/wcsrtombs.c
@@ -25,6 +25,8 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 
+static mbstate_t internal;
+
 size_t
 wcsrtombs (dst, src, len, ps)
      char *dst;
@@ -34,6 +36,9 @@ wcsrtombs (dst, src, len, ps)
 {
   size_t result = 0;
 
+  if (ps == NULL)
+    ps = &internal;
+
   /*************************************************************\
   |* This is no complete implementation.  While the multi-byte *|
   |* character handling is not finished this will do.	       *|