Back to index

glibc  2.9
tst-error1.c
Go to the documentation of this file.
00001 #include <error.h>
00002 #include <mcheck.h>
00003 #include <stdio.h>
00004 #include <string.h>
00005 #include <wchar.h>
00006 
00007 static int
00008 do_test (int argc, char *argv[])
00009 {
00010   mtrace ();
00011   (void) freopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr);
00012   /* Orient the stream.  */
00013   fwprintf (stderr, L"hello world\n");
00014   char buf[20000];
00015   static const char str[] = "hello world! ";
00016   for (int i = 0; i < 1000; ++i)
00017     memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
00018   error (0, 0, str);
00019   error (0, 0, buf);
00020   error (0, 0, buf);
00021   error (0, 0, str);
00022   return 0;
00023 }
00024 
00025 #define TEST_FUNCTION do_test (argc, argv)
00026 #include "../test-skeleton.c"