13 printf ("checking %s\n", s
);
14 for (int i
= 0; i
< len
- 3; i
++)
15 if (s
[i
] != s
[i
+ 1] && s
[i
+ 1] == s
[i
+ 2] && s
[i
] == s
[i
+ 3])
24 while (*s
&& s
[1] && s
[2]) {
25 if (s
[0] != s
[1] && s
[0] == s
[2])
33 match (const char *h
, const char *patt
)
35 char n
[4] = { patt
[1], patt
[0], patt
[1] };
36 printf ("looking for %s in %s\n", n
, h
);
40 int main(int argc
, char **argv
)
45 int count1
= 0, count2
= 0;
46 char super
[80], hyper
[80];
47 while ((nread
= getline(&line
, &len
, stdin
)) >= 0) {
48 line
[nread
- 1] = '\0';
50 printf ("parsing %s\n", line
);
51 super
[0] = hyper
[0] = '\0';
52 char *s
= super
, *h
= hyper
;
55 char *q
= strchrnul (p
, goal
);
57 s
+= sprintf (s
, "%.*s[]", (int) (q
- p
), p
);
59 h
+= sprintf (h
, "%.*s ", (int) (q
- p
), p
);
61 goal
^= 6; // cute ascii toggle between [ and ]
63 if (check (s
= super
) && ! check (hyper
))
65 while ((s
= find (s
)))
66 if (match (hyper
, s
++)) {
71 printf ("final count: TLS %d, SSL %d\n", count1
, count2
);