mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
0e15c4b6b5
2002-04-24 Ulrich Drepper <drepper@redhat.com> * elf/dl-load.c (open_verify): Correct __lseek parameters. Patch by Simon Hildrew <simon@hildrew.net> [PR libc/3354]. 2002-04-23 H.J. Lu <hjl@gnu.org> * include/math.h (isfinite): Fix a typo. 2002-04-24 Ulrich Drepper <drepper@redhat.com> * libio/bug-ungetwc2.c (test_locale): Use the de_DE.UTF-8 locale which is created by the test suite. 2002-04-20 Bruno Haible <bruno@clisp.org> * iconvdata/iso-2002-kr.c (MAX_NEEDED_FROM): Set to 4. (BODY for FROM_LOOP): Fix comparisons between inptr and inend. 2002-04-20 Bruno Haible <bruno@clisp.org> * iconvdata/johab.c (BODY for FROM_LOOP): Change type of i, m, f, to avoid gcc warning. 2002-04-20 Bruno Haible <bruno@clisp.org> * iconvdata/iso-2022-jp.c (EMIT_SHIFT_TO_INIT): Fix modification mask of data->__statep->__count. 2002-04-20 Bruno Haible <bruno@clisp.org> * iconvdata/euc-jisx0213.c (BODY for TO_LOOP): Really ignore Unicode tag characters. * iconvdata/shift_jisx0213.c (BODY for TO_LOOP): Likewise. * sysdeps/unix/sysv/linux/x86_64/ldconfig.h: New file. * sysdeps/unix/sysv/linux/x86_64/dl-cache.h: New file.
94 lines
2.0 KiB
C
94 lines
2.0 KiB
C
#define _XOPEN_SOURCE 500
|
|
#include <errno.h>
|
|
#include <error.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <locale.h>
|
|
#include <wchar.h>
|
|
|
|
const char test_locale[] = "de_DE.UTF-8";
|
|
const wchar_t write_wchars[] = {L'A', 0x00C4, L'B', L'\0'};
|
|
/* `0x00C4' is A with diaeresis. */
|
|
size_t last_pos = 2; /* Which character is last one to read. */
|
|
wint_t unget_wchar = L'C'; /* Ungotten ide characters. */
|
|
|
|
char *fname;
|
|
|
|
|
|
static int do_test (void);
|
|
#define TEST_FUNCTION do_test ()
|
|
|
|
#include "../test-skeleton.c"
|
|
|
|
|
|
static int
|
|
do_test (void)
|
|
{
|
|
size_t i;
|
|
wint_t wc;
|
|
FILE *fp;
|
|
int fd;
|
|
|
|
fname = (char *) malloc (strlen (test_dir) + sizeof "/bug-ungetwc2.XXXXXX");
|
|
if (fname == NULL)
|
|
{
|
|
puts ("no memory");
|
|
return 1;
|
|
}
|
|
strcpy (stpcpy (fname, test_dir), "/bug-ungetwc2.XXXXXX");
|
|
fd = mkstemp (fname);
|
|
if (fd == -1)
|
|
{
|
|
printf ("cannot open temporary file: %m\n");
|
|
return 1;
|
|
}
|
|
add_temp_file (fname);
|
|
|
|
printf ("\nNote: This program runs on %s locale.\n\n", test_locale);
|
|
|
|
if (setlocale (LC_ALL, test_locale) == NULL)
|
|
{
|
|
fprintf (stderr, "Cannot use `%s' locale.\n", test_locale);
|
|
exit (EXIT_FAILURE);
|
|
}
|
|
|
|
/* Output to the file. */
|
|
if ((fp = fdopen (fd, "w")) == NULL)
|
|
{
|
|
setlocale (LC_ALL, "C");
|
|
fprintf (stderr, "Cannot make `%s' file.\n", fname);
|
|
exit (EXIT_FAILURE);
|
|
}
|
|
fprintf (fp, "%ls", write_wchars);
|
|
fclose (fp);
|
|
|
|
/* Read from the file. */
|
|
fp = fopen (fname, "r");
|
|
if (fp == NULL)
|
|
{
|
|
setlocale (LC_ALL, "C");
|
|
error (EXIT_FAILURE, errno, "cannot open %s", fname);
|
|
}
|
|
|
|
printf ("%s is opened.\n", fname);
|
|
|
|
for (i = 0; i < last_pos; i++)
|
|
{
|
|
wc = getwc (fp);
|
|
printf ("> `%lc' is gotten.\n", wc);
|
|
}
|
|
|
|
/* Unget a wide character. */
|
|
ungetwc (unget_wchar, fp);
|
|
printf ("< `%lc' is ungotten.\n", unget_wchar);
|
|
|
|
/* Reget the wide character. */
|
|
wc = getwc (fp);
|
|
printf ("> `%lc' is regotten.\n", wc);
|
|
|
|
fflush (stdout);
|
|
fclose (fp);
|
|
|
|
return 0;
|
|
}
|