Back to index

glibc  2.9
nl_langinfo_l.c File Reference
#include <langinfo.h>
#include <locale.h>
#include <errno.h>
#include <stddef.h>
#include "localeinfo.h"

Go to the source code of this file.


char * __nl_langinfo_l (nl_item item, __locale_t l)

Function Documentation

char* __nl_langinfo_l ( nl_item  item,
__locale_t  l 

Definition at line 30 of file nl_langinfo_l.c.

  int category = _NL_ITEM_CATEGORY (item);
  unsigned int index = _NL_ITEM_INDEX (item);
  const struct locale_data *data;

  if (category < 0 || category == LC_ALL || category >= __LC_LAST)
    /* Bogus category: bogus item.  */
    return (char *) "";

  /* Special case value for NL_LOCALE_NAME (category).
     This is not a real item index in the string table.  */
  if (index == _NL_ITEM_INDEX (_NL_LOCALE_NAME (category)))
    return (char *) l->__names[category];

  data = l->__locales[category];

  if (index >= data->nstrings)
    /* Bogus index for this category: bogus item.  */
    return (char *) "";

  /* Return the string for the specified item.  */
  return (char *) data->values[index].string;

Here is the call graph for this function:

Here is the caller graph for this function: