Back to index

glibc  2.9
bug-strncat1.c
Go to the documentation of this file.
00001 /* Test case by Joseph S. Myers <jsm28@cam.ac.uk>.  */
00002 #undef __USE_STRING_INLINES
00003 #define __USE_STRING_INLINES
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <string.h>
00007 
00008 char d[3] = "\0\1\2";
00009 
00010 int
00011 main (void)
00012 {
00013   strncat (d, "\5\6", 1);
00014   if (d[0] != '\5')
00015     {
00016       puts ("d[0] != '\\5'");
00017       exit (1);
00018     }
00019   if (d[1] != '\0')
00020     {
00021       puts ("d[1] != '\\0'");
00022       exit (1);
00023     }
00024   if (d[2] != '\2')
00025     {
00026       puts ("d[2] != '\\2'");
00027       exit (1);
00028     }
00029 
00030   return 0;
00031 }