You can't use strtok() on string constants according to the man page:
Never use these functions. If you do, note that:
These functions modify their first argument.
These functions cannot be used on constant strings.
So if main() looks like:
...it will crash. But this should work:
char dirname = "newdir";