Changeset dbbbe75b in mainline for uspace/lib/posix/source/ctype.c
- Timestamp:
- 2018-01-15T21:54:21Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8348846
- Parents:
- c718bda
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/source/ctype.c
rc718bda rdbbbe75b 34 34 */ 35 35 36 #define LIBPOSIX_INTERNAL37 #define __POSIX_DEF__(x) posix_##x38 39 36 #include "posix/ctype.h" 40 41 /**42 * Checks whether character is a hexadecimal digit.43 *44 * @param c Character to inspect.45 * @return Non-zero if character match the definition, zero otherwise.46 */47 int posix_isxdigit(int c)48 {49 return isdigit(c) ||50 (c >= 'a' && c <= 'f') ||51 (c >= 'A' && c <= 'F');52 }53 54 /**55 * Checks whether character is a word separator.56 *57 * @param c Character to inspect.58 * @return Non-zero if character match the definition, zero otherwise.59 */60 int posix_isblank(int c)61 {62 return c == ' ' || c == '\t';63 }64 65 /**66 * Checks whether character is a control character.67 *68 * @param c Character to inspect.69 * @return Non-zero if character match the definition, zero otherwise.70 */71 int posix_iscntrl(int c)72 {73 return c < 0x20 || c == 0x7E;74 }75 76 /**77 * Checks whether character is any printing character except space.78 *79 * @param c Character to inspect.80 * @return Non-zero if character match the definition, zero otherwise.81 */82 int posix_isgraph(int c)83 {84 return posix_isprint(c) && c != ' ';85 }86 87 /**88 * Checks whether character is a printing character.89 *90 * @param c Character to inspect.91 * @return Non-zero if character match the definition, zero otherwise.92 */93 int posix_isprint(int c)94 {95 return posix_isascii(c) && !posix_iscntrl(c);96 }97 98 /**99 * Checks whether character is a punctuation.100 *101 * @param c Character to inspect.102 * @return Non-zero if character match the definition, zero otherwise.103 */104 int posix_ispunct(int c)105 {106 return !isspace(c) && !isalnum(c) && posix_isprint(c);107 }108 37 109 38 /** … … 113 42 * @return Non-zero if character match the definition, zero otherwise. 114 43 */ 115 int posix_isascii(int c)44 int isascii(int c) 116 45 { 117 46 return c >= 0 && c < 128; … … 124 53 * @return Coverted character. 125 54 */ 126 int posix_toascii(int c)55 int toascii(int c) 127 56 { 128 57 return c & 0x7F;
Note:
See TracChangeset
for help on using the changeset viewer.