Listing 6 token2.c — uses strtokf to extract alphabetic tokens.

/* token2.c: Parse input strings via strtokf() */

#include <stdio.h>
#include <ctype.h>

char *strtokf(char *, int (*)(char));
static int filter(char);

main()
{
   char s[81];

   while (gets(s))
   {
      char *tokp, *sp = s;

      while ((tokp = strtokf(sp,filter)) != NULL)
      {
          puts(tokp);
          sp = NULL;
      }
   }
   return 0;
}

static int filter(char c)
{
   return isalpha(c);
}

/* End of  File */