Blame libio/tst-setvbuf1.c

Packit 6c4009
/* Dereived from the test case in BZ #2337.  */
Packit 6c4009
#include <errno.h>
Packit 6c4009
#include <error.h>
Packit 6c4009
#include <fcntl.h>
Packit 6c4009
#include <locale.h>
Packit 6c4009
#include <stdio.h>
Packit 6c4009
#include <stdlib.h>
Packit 6c4009
#include <string.h>
Packit 6c4009
#include <unistd.h>
Packit 6c4009
#include <wchar.h>
Packit 6c4009
Packit 6c4009
Packit 6c4009
static char buf[512] __attribute__ ((aligned (4096)));
Packit 6c4009
Packit 6c4009
Packit 6c4009
static int
Packit 6c4009
do_test (void)
Packit 6c4009
{
Packit 6c4009
  setlocale (LC_ALL, "de_DE.UTF-8");
Packit 6c4009
Packit 6c4009
  FILE *fp = fdopen (dup (STDOUT_FILENO), "a");
Packit 6c4009
  if (fp == NULL)
Packit 6c4009
    error (EXIT_FAILURE, errno, "fdopen(,\"a\")");
Packit 6c4009
Packit 6c4009
  setvbuf (fp, buf, _IOFBF, sizeof (buf));
Packit 6c4009
Packit 6c4009
  /* fwprintf to unbuffered stream.   */
Packit 6c4009
  fwprintf (fp, L"hello.\n");
Packit 6c4009
Packit 6c4009
  fclose (fp);
Packit 6c4009
Packit 6c4009
  /* touch my buffer */
Packit 6c4009
  buf[45] = 'a';
Packit 6c4009
Packit 6c4009
  return 0;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
#define TEST_FUNCTION do_test ()
Packit 6c4009
#include "../test-skeleton.c"