/************************************************************* * File: lib/strnwrd.c * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: * 970304 Start of revision history */ #include "string.h" /** strnwrd(p) returns a count of words in p */ strnwrd(p) char *p; { int n; if (!p) return(0); for (n=0;*p;n++) { while (isspace(*p)) p++; if (! *p) return(n); while (!isspace(*p) && *p != 0) p++; } return(n); }