Back to index

nagios-plugins  1.4.16
Functions
wcrtomb.c File Reference
#include <config.h>
#include <wchar.h>
#include <errno.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps)

Function Documentation

size_t wcrtomb ( char *  s,
wchar_t  wc,
mbstate_t ps 
)

Definition at line 28 of file wcrtomb.c.

{
  /* This implementation of wcrtomb on top of wctomb() supports only
     stateless encodings.  ps must be in the initial state.  */
  if (ps != NULL && !mbsinit (ps))
    {
      errno = EINVAL;
      return (size_t)(-1);
    }

  if (s == NULL)
    /* We know the NUL wide character corresponds to the NUL character.  */
    return 1;
  else
    {
      int ret = wctomb (s, wc);

      if (ret >= 0)
        return ret;
      else
        {
          errno = EILSEQ;
          return (size_t)(-1);
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: