~vorlon/ubuntu/natty/eglibc/multiarch

« back to all changes in this revision

Viewing changes to string/bug-strstr1.c

  • Committer: Steve Langasek
  • Date: 2011-02-18 21:18:44 UTC
  • mfrom: (103.1.7 eglibc)
  • Revision ID: steve.langasek@linaro.org-20110218211844-lodmi8b1qhyq3f3x
Tags: 2.13~pre1-0ubuntu1+multiarch.1
merge from natty

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <string.h>
 
3
 
 
4
int main (int argc, char** argv)
 
5
{
 
6
  const char haystack[] =
 
7
    "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_A7_20_EF_BF_BD";
 
8
 
 
9
  const char needle[] =
 
10
    "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
 
11
 
 
12
  const char* sub = strstr (haystack, needle);
 
13
 
 
14
  if (sub != NULL)
 
15
    {
 
16
      int j;
 
17
 
 
18
      fprintf (stderr, "BUG: expected NULL, got:\n%s\n%s\n", sub, needle);
 
19
      for (j = 0; needle[j] != '\0'; ++j)
 
20
        putchar (needle[j] == sub[j] ? ' ' : '^');
 
21
      puts ("");
 
22
      return 1;
 
23
    }
 
24
 
 
25
  return 0;
 
26
}