Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strcspn(3) [osf1 man page]

strspn(3)						     Library Functions Manual							 strspn(3)

NAME
strcspn, strspn - Returns length of initial segment of string LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> size_t strcspn( const char *s1, const char *s2); size_t strspn( const char *s1, const char *s2); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strcspn(), strspn(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a character string being checked for an initial segment. Points to a string containing a set of bytes that define the initial segment. DESCRIPTION
The strspn() function computes the length of the maximum initial segment of the string pointed to by the s1 parameter, which consists entirely of bytes from the string pointed to by the s2 parameter. The strcspn() function computes the byte length of the maximum initial segment of the string pointed to by the s1 parameter, which consists entirely of bytes that are not from the string pointed to by the s2 parameter. The strspn() and strcspn() functions treat the s2 parameter as a series of bytes; these functions do not treat a multibyte character as a single unit but rather as a series of separate bytes. There are no equivalent functions for multibyte character strings. The wcsspn() and wcscspn() functions provide the same functionality for wide character strings. RETURN VALUES
Upon successful completion, the strcspn(), and strspn() functions return the length of the string segment. [Tru64 UNIX] On error, a value of -1 cast to size_t is returned. RELATED INFORMATION
Functions: string(3), wcsspn(3)/wcscspn(3) Standards: standards(5) delim off strspn(3)

Check Out this Related Man Page

strcpy(9F)						   Kernel Functions for Drivers 						strcpy(9F)

NAME
strcpy, strlcat, strlcpy, strncat, strncpy, strspn - String operations. SYNOPSIS
#include <sys/ddi.h> char *strcpy(char *dst, const char *src); size_t strlcat(char *dst, const char *src, size_t dstsize); size_t strlcpy(char *dst, const char *src, size_t dstsize); char *strncat(char *restrict s1, const char *restrict s2, size_t n); char *strncpy(char *dst, const char *src, size_t n); size_t strspn(const char *s1, const char *s2); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
dst, src Pointers to character strings. s1, s2 Pointers to character strings. n Count of characters to be copied. DESCRIPTION
The arguments dst, src, s1 and s2 point to strings. The strcpy(), strlcpy(), strncpy(), strlcat() and strncat() functions all alter their first argument. These functions do not check for overflow of the array pointed to by the first argument. strcpy() The strcpy() function copies characters in the string src to dst, terminating at the first null character in src, and returns dst to the caller. No bounds checking is done. strncpy() The strncpy() function copies src to dst, null-padding or truncating at n bytes, and returns dst. No bounds checking is done. strlcpy() The strlcpy() function copies a maximum of dstsize-1 characters (where dstsize represents the size of the string buffer dst) from src to dst, truncating src if necessary. The result is always null-terminated. The function returns strlen(src). Buffer overflow can be checked as follows: if (strlcpy(dst, src, dstsize) >= dstsize) return (-1); strncat() The strncat() function appends a maximum of n characters. The initial character of s2 overrides the null character at the end of s1. strlcat() The strlcat() function appends a maximum of (dstsize- strlen(dst)-1) characters of src to dst (where dstsize represents the size of the string buffer dst). If the string pointed to by dst contains a null-terminated string that fits into dstsize bytes when strlcat() is called, the string pointed to by dst is a null-terminated string that fits in dstsize bytes (including the terminating null character) when it completes, and the initial character of src overrides the null character at the end of dst. If the string pointed to by dst is longer than dstsize bytes when strlcat() is called, the string pointed to by dst is not changed. The function returns min{dst- size,strlen(dst)}+strlen(src). Buffer overflow can be checked as follows: if (strlcat(dst, src, dstsize) >= dstsize) return -1; strspn() The strspn() function returns the length of the initial segment of string s1 that consists entirely of characters from string s2. RETURN VALUES
strcpy(), strncat() and strncpy() return dst. For strlcat(), strlcpy() and strspn(), see the Description section. CONTEXT
These functions can be called from user or interrupt context. SEE ALSO
strlen(9F), strcmp(9F), bcopy(9F), ddi_copyin(9F) Writing Device Drivers SunOS 5.10 7 Sep 2004 strcpy(9F)
Man Page