32 REQUIRES( findCh >= 0 && findCh <= 0x7F );
34 for( i = 0; i <
strLen; i++ )
36 if( str[ i ] == findCh )
53 assert(
isReadPtr( findStr, findStrLen ) );
57 REQUIRES( findCh >= 0 && findCh <= 0x7F );
59 for( i = 0; i <= strLen - findStrLen; i++ )
61 if(
toUpper( str[ i ] ) == findCh && \
79 for( i = 0; i < strLen && ( str[ i ] ==
' ' || str[ i ] ==
'\t' ); i++ );
80 return( ( i < strLen ) ? i : -1 );
96 for( i = 0; i < strLen && str[ i ] !=
' ' && str[ i ] !=
'\t'; i++ );
97 return( i > 0 ? i : -1 );
107 assert(
isReadPtr( newStringPtr,
sizeof(
char * ) ) );
113 *newStringPtr = NULL;
117 startPos < strLen && \
120 if( startPos >= strLen )
123 for( endPos = strLen;
124 endPos > startPos && \
125 (
string[ endPos - 1 ] ==
' ' ||
string[ endPos - 1 ] ==
'\t' );
127 ENSURES( endPos - startPos > 0 );
128 return( endPos - startPos );
162 int strExtract(
OUT_OPT_PTR const char **newStringPtr,
169 assert(
isReadPtr( newStringPtr,
sizeof(
char * ) ) );
173 REQUIRES( startOffset >= 0 && startOffset <= strLen && \
180 *newStringPtr = NULL;
194 int strGetNumeric(
IN_BUFFER( strLen )
const char *str,
197 IN_RANGE( 0, 100 )
const int minValue,
203 assert(
isWritePtr( numericValue,
sizeof(
int ) ) );
206 REQUIRES( minValue >= 0 && minValue < maxValue && \
213 if( strLen < 1 || strLen > 7 )
217 for( value = 0, i = 0; i <
strLen; i++ )
219 const int valTmp = value * 10;
222 if( ch < 0 || ch > 9 )
236 *numericValue =
value;
272 const int strDataLen =
min( strLen, strMaxLen );
278 "(Internal error)" );
280 "(Internal error)" );
284 for( i = 0; i < strDataLen; i++ )
288 if( ch <= 0 || ch > 0x7F || !
isPrint( ch ) )
295 if( ( strLen > strMaxLen ) && ( strMaxLen > 8 ) )
296 memcpy(
string + strMaxLen - 6,
"[...]", 5 );
300 if( strLen < strMaxLen )
303 string[ strMaxLen - 1 ] =
'\0';
307 return( (
char * )
string );
316 #ifndef __STDC_LIB_EXT1__
332 assert(
isWritePtr( retval,
sizeof(
size_t ) ) );
343 bytesCopied = mbstowcs( dst, src, len );
344 if( ( bytesCopied == (
size_t ) -1 ) || ( bytesCopied <= 0 ) )
359 assert(
isWritePtr( retval,
sizeof(
size_t ) ) );
370 bytesCopied = wcstombs( dst, src, len );
371 if( ( bytesCopied == (
size_t ) -1 ) || ( bytesCopied <= 0 ) )