home *** CD-ROM | disk | FTP | other *** search
- /*
- * strwc.c
- * contains: strwc()
- *
- */
-
- #include <stdio.h>
- #include "gfuncts.h"
-
- /*
- * int
- * strwc(str)
- *
- * ARGUMENT
- * (char *) str - points to string to count
- *
- * DESCRIPTION
- * string word count, the string is scanned from left to right and words
- * are counted. The number of words is returned. The function counts any
- * number of 1 or more contigious characters bounded by white space or
- * the beginning or end of the string as a word.
- *
- * RETURNS
- * number of words counted
- *
- * AUTHOR
- * Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- *
- * MODIFICATIONS
- *
- */
- int GF_CONV strwc(str)
- char *str;
- {
- int wordcount,inword;
-
- for(wordcount=inword=0;*str;++str)
- if(!gisspace(*str)&&!inword) {
- ++wordcount;
- inword=1;
- } else if(gisspace(*str)&&inword)
- inword=0;
- return(wordcount);
- }
-