safec  3.0
Safe C Library - ISO TR24731 Bounds Checking Interface
strcspn_s.c File Reference
#include "safe_str_lib.h"
+ Include dependency graph for strcspn_s.c:

Functions

EXPORT errno_t strcspn_s (const char *dest, rsize_t dmax, const char *src, rsize_t slen, rsize_t *count)
 This function computes the prefix length of the string pointed to by dest which consists entirely of characters that are excluded from the string pointed to by src. More...
 

Function Documentation

◆ strcspn_s()

EXPORT errno_t strcspn_s ( const char *  dest,
rsize_t  dmax,
const char *  src,
rsize_t  slen,
rsize_t count 
)

This function computes the prefix length of the string pointed to by dest which consists entirely of characters that are excluded from the string pointed to by src.

The scanning stops at the first null in dest or after dmax characters. The exclusion string is checked to the null or after slen characters.

Remarks
EXTENSION TO ISO/IEC TR 24731, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
Parameters
[in]destpointer to string to determine the prefix
[in]dmaxrestricted maximum length of string dest
[in]srcpointer to exclusion string
[in]slenrestricted maximum length of string src
[out]countpointer to a count variable that will be updated with the dest substring length
Precondition
Neither dest nor src shall be a null pointer.
count shall not be a null pointer.
dmax shall not be 0
dmax shall not be greater than RSIZE_MAX_STR
Return values
EOKwhen operation is successful
ESNULLPwhen dest/src/count is NULL pointer
ESZEROLwhen dmax/slen = 0
ESLEMAXwhen dmax/slen > RSIZE_MAX_STR
See also
strspn_s(), strpbrk_s(), strstr_s()