Back to index

glibc  2.9
Functions
wctrans_l.c File Reference
#include <locale.h>
#include <string.h>
#include <wctype.h>
#include "../locale/localeinfo.h"

Go to the source code of this file.

Functions

wctrans_t __wctrans_l (const char *property, __locale_t locale)

Function Documentation

wctrans_t __wctrans_l ( const char *  property,
__locale_t  locale 
)

Definition at line 25 of file wctrans_l.c.

{
  const char *names;
  size_t cnt;
  size_t i;

  names = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_NAMES)].string;
  cnt = 0;
  while (names[0] != '\0')
    {
      if (strcmp (property, names) == 0)
       break;

      names = strchr (names, '\0') + 1;
      ++cnt;
    }

  if (names[0] == '\0')
    return 0;

  i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + cnt;
  return (wctrans_t) locale->__locales[LC_CTYPE]->values[i].string;
}