Back to index

glibc  2.9
Functions | Variables
strerror_l.c File Reference
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>

Go to the source code of this file.

Functions

static const char * translate (const char *str, locale_t loc)
char * strerror_l (int errnum, locale_t loc)

Variables

static __thread char * last_value

Function Documentation

char* strerror_l ( int  errnum,
locale_t  loc 
)

Definition at line 42 of file strerror_l.c.

{


  if (__builtin_expect (errnum < 0 || errnum >= _sys_nerr_internal
                     || _sys_errlist_internal[errnum] == NULL, 0))
    {
      free (last_value);
      if (__asprintf (&last_value, "%s%d",
                    translate ("Unknown error ", loc), errnum) == -1)
       last_value = NULL;

      return last_value;
    }

  return (char *) translate (_sys_errlist_internal[errnum], loc);
}

Here is the call graph for this function:

static const char* translate ( const char *  str,
locale_t  loc 
) [static]

Definition at line 31 of file strerror_l.c.

{
  locale_t oldloc = __uselocale (loc);
  const char *res = _(str);
  __uselocale (oldloc);
  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

__thread char* last_value [static]

Definition at line 27 of file strerror_l.c.