You left out strspn in your example code, right?

However, what shell do you use to call your program?