/* file ntokens.c */

#if !defined(COMPILE_ENVIRONMENT)
#include <gp/stdcenvf.h> /* std compile environment for functions */
#endif


 int ntokens(s) char *s;
/******************************************************************/
/*  Computes & returns the number of tokens in string *s.         */
/******************************************************************/
  {char *proc = "ntokens";
   int n;
   SUBSTRING x1, *x = &x1, y1, *y = &y1;
db_enter_msg(proc,1); /* debug only */
   x->start = pltrimf(s);
   x->end   = prtrim(s);
   n = 0;
   do 
     {find_next_token2(x,y);
      x->start = y->end + 1;
      n += 1;
     }
   while (substr_length(y) > 0);
   n -= 1;
db_leave_msg(proc,1); /* debug only */
   return n;
  }
