Back to index

glibc  2.9
tst-gettext3.c File Reference
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.


int main (void)

Function Documentation

int main ( void  )

Definition at line 29 of file tst-gettext3.c.

  char *s;
  int result = 0;

  unsetenv ("LANGUAGE");
  unsetenv ("OUTPUT_CHARSET");
  textdomain ("codeset");
  bindtextdomain ("codeset", OBJPFX "domaindir");

  setlocale (LC_ALL, "de_DE.ISO-8859-1");

  /* Here we expect output in ISO-8859-1.  */
  s = gettext ("cheese");
  if (strcmp (s, "K\344se"))
      printf ("call 1 returned: %s\n", s);
      result = 1;

  setlocale (LC_ALL, "de_DE.UTF-8");

  /* Here we expect output in UTF-8.  */
  s = gettext ("cheese");
  if (strcmp (s, "K\303\244se"))
      printf ("call 2 returned: %s\n", s);
      result = 1;

  return result;

Here is the call graph for this function: