This is the synopsis for strspn
:
#include <string.h>
size_t strspn(const char *s1, const char *s2);
This is the description and return value for POSIX.1-2001:
The strspn() function shall compute the length (in bytes) of the maximum initial segment of the string pointed to by s1 which consists entirely of bytes from the string pointed to by s2.
The strspn() function shall return the length of s1; no return value is reserved to indicate an error.
This is (almost) the same from POSIX.1-2017:
The strspn() function shall compute the length (in bytes) of the maximum initial segment of the string pointed to by s1 which consists entirely of bytes from the string pointed to by s2.
The strspn() function shall return the computed length; no return value is reserved to indicate an error.
Is it possible for an implementation of strspn
to be compliant with both POSIX.1-2001 and POSIX.1-2017? How?