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

int total_words ;
void *count_words(void *);

int main(int ac, char *av[])
{
  ...

  if ( ac != 3 ){
     printf("usage: %s file1 file2\n", av[0]);
     exit(1);
  }
  total_words = 0;
  ...
  printf("%5d: total words\n", total_words);
  return 0;
}
void *count_words(void *f)
{
  char *filename = (char *) f;
  FILE *fp;
  int  c, prevc = '\0';
  
  if ( (fp = fopen(filename, "r")) != NULL ){
    while( ( c = getc(fp)) != EOF ){
      if ( !isalnum(c) && isalnum(prevc) )
        total_words++;
      prevc = c;
    }
  fclose(fp);
  }  
  else 
    perror(filename);
  return NULL;
}

