int str_word_num(char *s) { int cnt = 0; while (*s != '\0') { if (!ISLETTER(*s)) { s++; continue; } do{ s++; }while(ISLETTER(*s)); cnt++; } return cnt; }
/* ** void MakeExpandedName(char ARG_PTR *pszFileName, BYTE byteExtensionChar); ** ** Create expanded output file name. ** ** Arguments: pszFileName - expanded file name to change ** byteExtensionChar - expanded file name extension character to ** use ** ** Returns: void ** ** Globals: none */ VOID MakeExpandedName(CHAR ARG_PTR *pszFileName, BYTE byteExtensionChar) { CHAR ARG_PTR *pszExt; INT nExtLen; // Is there any extension to change? if ((pszExt = ExtractExtension(pszFileName)) != NULL) { // Determine case of extension character. Match case of first non-DB // character in name. If all characters are DB, leave case alone. if (ISLETTER(byteExtensionChar)) { // Find first alphabetic character in name. while (*pszFileName) { #ifdef DBCS if (IsDBCSLeadByte(*pszFileName)) pszFileName += 2; else #endif if (ISLETTER(*pszFileName)) break; else pszFileName++; } // Here pszFileName points to the first alphabetic character in the // name or to the null terminator. Set the case of the extension // character. if (ISLOWER(*pszFileName)) byteExtensionChar = (BYTE)TOLOWERCASE(byteExtensionChar); else if (ISUPPER(*pszFileName)) byteExtensionChar = (BYTE)TOUPPERCASE(byteExtensionChar); } #ifdef DBCS if ((nExtLen = STRLEN(pszExt)) > 0) { // Find the underscore character to replace, if it exists. // Assert: The underscore is either the last character in the // extension, or it is the first character in the extension followed // by a double-byte character. if (! IsDBCSLeadByte(*pszExt) && *pszExt == chEXTENSION_CHAR && IsDBCSLeadByte(pszExt[1])) // Here the underscore is followed by a double-byte character. *pszExt = byteExtensionChar; else { // Here the underscore is the last character in the extension, if // there is an underscore at all. CHAR ARG_PTR *psz, *pszPrevious; for (psz = pszPrevious = pszExt; *psz != '\0'; psz = AnsiNext(psz)) pszPrevious = psz; if (! IsDBCSLeadByte(*pszPrevious) && *pszPrevious == chEXTENSION_CHAR) *pszPrevious = byteExtensionChar; } } #else if ((nExtLen = STRLEN(pszExt)) > 0 && pszExt[nExtLen - 1] == chEXTENSION_CHAR) // Handle expected renamed form. pszExt[nExtLen - 1] = byteExtensionChar; #endif // Get rid of trailing dot with no extension. if (*pszExt == '\0' && *(pszExt - 1) == PERIOD) *(pszExt - 1) = '\0'; } }