Skip Navigation Links | |
Exit Print View | |
man pages section 3: Basic Library Functions Oracle Solaris 11.1 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- validate UTF-8 characters and calculate the byte length
#include <sys/u8_textprep.h> int u8_validate(char *u8str, size_t n, char **list, int flag, int *errnum);
The UTF-8 string to be validated.
The maximum number of bytes in u8str that can be examined and validated.
A list of null-terminated character strings in UTF-8 that must be additionally checked against as invalid characters. The last string in list must be null to indicate there is no further string.
Possible validation options constructed by a bitwise-inclusive-OR of the following values:
By default, u8_validate() looks at the first character or up to n bytes, whichever is smaller in terms of the number of bytes to be consumed, and returns with the result.
When this option is used, u8_validate() will check up to n bytes from u8str and possibly more than a character before returning the result.
By default, u8_validate() does not use list supplied.
When this option is supplied with a list of character strings, u8_validate() additionally validates u8str against the character strings supplied with list and returns EBADF in errnum if u8str has any one of the character strings in list.
By default, u8_validate() uses the entire Unicode coding space of U+0000 to U+10FFFF.
When this option is specified, the valid Unicode coding space is smaller to U+0000 to U+FFFF.
An error occurred during validation. The following values are supported:
Validation failed because list-specified characters were found in the string pointed to by u8str.
Validation failed because an illegal byte was found in the string pointed to by u8str.
Validation failed because an incomplete byte was found in the string pointed to by u8str.
Validation failed because character bytes were encountered that are outside the range of the Unicode coding space.
The u8_validate() function validates u8str in UTF-8 and determines the number of bytes constituting the character(s) pointed to by u8str.
If u8str is a null pointer, u8_validate() returns 0. Otherwise, u8_validate() returns either the number of bytes that constitute the characters if the next n or fewer bytes form valid characters, or -1 if there is an validation failure, in which case it may set errnum to indicate the error.
Example 1 Determine the length of the first UTF-8 character.
#include <sys/u8_textprep.h> char u8[MAXPATHLEN]; int errnum; . . . len = u8_validate(u8, 4, (char **)NULL, 0, &errnum); if (len == -1) { switch (errnum) { case EILSEQ: case EINVAL: return (MYFS4_ERR_INVAL); case EBADF: return (MYFS4_ERR_BADNAME); case ERANGE: return (MYFS4_ERR_BADCHAR); default: return (-10); } }
Example 2 Check if there are any invalid characters in the entire string.
#include <sys/u8_textprep.h> char u8[MAXPATHLEN]; int n; int errnum; . . . n = strlen(u8); len = u8_validate(u8, n, (char **)NULL, U8_VALIDATE_ENTIRE, &errnum); if (len == -1) { switch (errnum) { case EILSEQ: case EINVAL: return (MYFS4_ERR_INVAL); case EBADF: return (MYFS4_ERR_BADNAME); case ERANGE: return (MYFS4_ERR_BADCHAR); default: return (-10); } }
Example 3 Check if there is any invalid character, including prohibited characters, in the entire string.
#include <sys/u8_textprep.h> char u8[MAXPATHLEN]; int n; int errnum; char *prohibited[4] = { ".", "..", "\\", NULL }; . . . n = strlen(u8); len = u8_validate(u8, n, prohibited, (U8_VALIDATE_ENTIRE|U8_VALIDATE_CHECK_ADDITIONAL), &errnum); if (len == -1) { switch (errnum) { case EILSEQ: case EINVAL: return (MYFS4_ERR_INVAL); case EBADF: return (MYFS4_ERR_BADNAME); case ERANGE: return (MYFS4_ERR_BADCHAR); default: return (-10); } }
See attributes(5) for descriptions of the following attributes:
|
u8_strcmp(3C), u8_textprep_str(3C), attributes(5), u8_strcmp(9F), u8_textprep_str(9F), u8_validate(9F)