Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strlen(3) [osf1 man page]

strlen(3)						     Library Functions Manual							 strlen(3)

NAME
strlen - Finds the length of a string LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> size_t strlen( const char *s); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strlen(): ISO C, XPG4 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the string. DESCRIPTION
The strlen() function returns the number of bytes in the string pointed to by the s parameter. The string length value does not include the terminating null character. Note If you pass a NULL pointer as the const char * parameter to the strlen function, the function generates a segmentation violation. To avoid the segmentation violation and cause the function to return 0 (zero), change the NULL pointer treatment for the process before issuing the call to the strlen function, as follows: Include the system header file sys/uswitch.h. Call the uswitch function, as described in the uswitch(2) reference page. The following program illustrates this procedure: #include <stdio.h> #include <sys/types.h> #include <sys/uswitch.h> main() { size_t retval; int uswitch_val; uswitch_val = uswitch(USC_GET,0); uswitch(USC_SET, uswitch_val | USW_NULLP); retval = strlen(NULL); RETURN VALUES
On successful completion, the strlen() function returns the number of characters (bytes) in the string to which the s parameter points. Current industry standards specify that no value be reserved to indicate an error. RELATED INFORMATION
Functions: string(3), uswitch(2), wcslen(3) Standards: standards(5) delim off strlen(3)

Check Out this Related Man Page

uswitch(2)							System Calls Manual							uswitch(2)

NAME
uswitch - Get or set compatibility environment specific behavior for a calling process through the uswitch value. SYNOPSIS
#include <sys/uswitch.h> long uswitch( long cmd, long mask ); PARAMETERS
Specifies the requested actions. The valid cmd values are: Returns the current uswitch value for the calling process. If mask is non-zero, it returns the status of specific uswitch bit-mask(s). Changes the current uswitch value for the calling process as specified by the mask bit-mask(s). The following bit-masks are valid when specified with either of the values for the cmd parameter: Specifies System V NULL pointer behavior. Specifies process requests enhanced core file naming. DESCRIPTION
The uswitch system call is used to get or change the compatibility environment specific behavior in Tru64 UNIX. Any changes affect the calling process and its children. When the USW_NULLP bit of uswitch is set to 1, the System V method of treating NULL pointers is applied. In this method, references to a NULL pointer always returns zero (0). When this bit-mask is reset to zero (0), subsequent references to a NULL pointer generate a segmen- tation violation signal (SIGSEGV). When the USW_CORE bit of uswitch is set to 1, the process requests enhanced core file naming. The bit-mask, when set, can be inherited when the process forks. The bit-mask is cleared when an exec system call is executed. See core(4) for more information about core files. Any write(2) references to NULL pointers generate a segmentation violation signal (SIGSEGV) regardless of the uswitch value. NOTES
Usage of this system call may make the application non-portable. RETURN VALUES
Upon successful completion, either the current or new uswitch value for mask is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
If the uswitch system call fails, the uswitch value remains unchanged and errno is set to the following: The mask is greater than USW_MAX or less than USW_MIN. EXAMPLES
The following code sample sets the bit mask for System V NULL pointer behavior: long uswitch_val; ... uswitch_val = uswitch(USC_GET,0); /* Gets current value*/ uswitch(USC_SET, uswitch_val | USW_NULLP); /* Sets USW_NULLP bit */ The following code sample sets the bit mask for enhanced core file names: long uswitch_val; ... uswitch_val = uswitch(USC_GET,0); /* Gets current value*/ uswitch(USC_SET, uswitch_val | USW_CORE); /* Sets USW_CORE bit */ uswitch(2)
Man Page