scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

0023-strpbrk.c (435B)


      1 #include <assert.h>
      2 #include <stdio.h>
      3 #include <string.h>
      4 
      5 /*
      6 output:
      7 testing
      8 done
      9 end:
     10 */
     11 
     12 int
     13 main()
     14 {
     15 	char buf[] = "abcdef";
     16 
     17 	puts("testing");
     18 	assert(strpbrk(buf, "a") == buf);
     19 	assert(strpbrk(buf, "") == NULL);
     20 	assert(strpbrk("", "a") == NULL);
     21 	assert(strpbrk("", "") == NULL);
     22 	assert(strpbrk(buf, "1234") == NULL);
     23 	assert(strpbrk(buf, "f") == buf + 5);
     24 	assert(strpbrk(buf, "12345a") == buf);
     25 	puts("done");
     26 
     27 	return 0;
     28 }