Back to index

courier  0.68.2
Defines | Functions
printf.c File Reference
#include <stdio.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "printf-args.c"
#include "printf-parse.c"
#include "vasnprintf.c"

Go to the source code of this file.

Defines

#define EOVERFLOW   E2BIG
#define DLL_EXPORTED
#define STATIC   static
#define vasnprintf   libintl_vasnprintf

Functions

char * alloca ()
DLL_EXPORTED int libintl_vfprintf (FILE *stream, const char *format, va_list args)
DLL_EXPORTED int libintl_fprintf (FILE *stream, const char *format,...)
DLL_EXPORTED int libintl_vprintf (const char *format, va_list args)
DLL_EXPORTED int libintl_printf (const char *format,...)
DLL_EXPORTED int libintl_vsprintf (char *resultbuf, const char *format, va_list args)
DLL_EXPORTED int libintl_sprintf (char *resultbuf, const char *format,...)

Define Documentation

#define DLL_EXPORTED

Definition at line 68 of file printf.c.

#define EOVERFLOW   E2BIG

Definition at line 57 of file printf.c.

#define STATIC   static

Definition at line 71 of file printf.c.

#define vasnprintf   libintl_vasnprintf

Definition at line 88 of file printf.c.


Function Documentation

char* alloca ( )
DLL_EXPORTED int libintl_fprintf ( FILE *  stream,
const char *  format,
  ... 
)

Definition at line 124 of file printf.c.

{
  va_list args;
  int retval;

  va_start (args, format);
  retval = libintl_vfprintf (stream, format, args);
  va_end (args);
  return retval;
}

Here is the call graph for this function:

DLL_EXPORTED int libintl_printf ( const char *  format,
  ... 
)

Definition at line 144 of file printf.c.

{
  va_list args;
  int retval;

  va_start (args, format);
  retval = libintl_vprintf (format, args);
  va_end (args);
  return retval;
}

Here is the call graph for this function:

DLL_EXPORTED int libintl_sprintf ( char *  resultbuf,
const char *  format,
  ... 
)

Definition at line 182 of file printf.c.

{
  va_list args;
  int retval;

  va_start (args, format);
  retval = libintl_vsprintf (resultbuf, format, args);
  va_end (args);
  return retval;
}

Here is the call graph for this function:

DLL_EXPORTED int libintl_vfprintf ( FILE *  stream,
const char *  format,
va_list  args 
)

Definition at line 97 of file printf.c.

{
  if (strchr (format, '$') == NULL)
    return vfprintf (stream, format, args);
  else
    {
      size_t length;
      char *result = libintl_vasnprintf (NULL, &length, format, args);
      int retval = -1;
      if (result != NULL)
        {
          size_t written = fwrite (result, 1, length, stream);
          free (result);
          if (written == length)
            {
              if (length > INT_MAX)
                errno = EOVERFLOW;
              else
                retval = length;
            }
        }
      return retval;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

DLL_EXPORTED int libintl_vprintf ( const char *  format,
va_list  args 
)

Definition at line 137 of file printf.c.

{
  return libintl_vfprintf (stdout, format, args);
}

Here is the call graph for this function:

Here is the caller graph for this function:

DLL_EXPORTED int libintl_vsprintf ( char *  resultbuf,
const char *  format,
va_list  args 
)

Definition at line 157 of file printf.c.

{
  if (strchr (format, '$') == NULL)
    return vsprintf (resultbuf, format, args);
  else
    {
      size_t length = (size_t) ~0 / (4 * sizeof (char));
      char *result = libintl_vasnprintf (resultbuf, &length, format, args);
      if (result != resultbuf)
        {
          free (result);
          return -1;
        }
      if (length > INT_MAX)
        {
          errno = EOVERFLOW;
          return -1;
        }
      else
        return length;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: