Changeset 21abb9a in mainline
- Timestamp:
- 2011-06-22T14:12:45Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0319e104
- Parents:
- 8d7e82c1
- Location:
- uspace/lib/posix
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/ctype.c
r8d7e82c1 r21abb9a 38 38 #include "ctype.h" 39 39 40 // TODO: propose for inclusion in libc 41 40 42 /** 41 * 42 * @param ch 43 * Checks whether character is a hexadecimal digit. 44 * 45 * @param c 43 46 * @return 44 47 */ 45 int posix_isxdigit(int c h)48 int posix_isxdigit(int c) 46 49 { 47 return isdigit(ch) || 48 (ch >= 'a' && ch <= 'f') || 49 (ch >= 'A' && ch <= 'F'); 50 return isdigit(c) || 51 (c >= 'a' && c <= 'f') || 52 (c >= 'A' && c <= 'F'); 53 } 54 55 /** 56 * Checks whether character is a word separator. 57 * 58 * @param c 59 * @return 60 */ 61 int posix_isblank(int c) 62 { 63 return c == ' ' || c == '\t'; 64 } 65 66 /** 67 * Checks whether character is a control character. 68 * 69 * @param c 70 * @return 71 */ 72 int posix_iscntrl(int c) 73 { 74 return c < 0x20 || c == 0x7E; 75 } 76 77 /** 78 * Checks whether character is any printing character except space. 79 * 80 * @param c 81 * @return 82 */ 83 int posix_isgraph(int c) 84 { 85 return posix_isprint(c) && c != ' '; 86 } 87 88 /** 89 * Checks whether character is a printing character. 90 * 91 * @param c 92 * @return 93 */ 94 int posix_isprint(int c) 95 { 96 return !posix_iscntrl(c); 97 } 98 99 /** 100 * Checks whether character is a punctuation. 101 * 102 * @param c 103 * @return 104 */ 105 int posix_ispunct(int c) 106 { 107 return !isspace(c) && !isalnum(c); 50 108 } 51 109 -
uspace/lib/posix/ctype.h
r8d7e82c1 r21abb9a 40 40 41 41 /* Classification of Characters */ 42 extern int posix_isxdigit(int ch); 42 extern int posix_isxdigit(int c); 43 extern int posix_isblank(int c); 44 extern int posix_iscntrl(int c); 45 extern int posix_isgraph(int c); 46 extern int posix_isprint(int c); 47 extern int posix_ispunct(int c); 43 48 44 49 #ifndef LIBPOSIX_INTERNAL 45 50 #define isxdigit posix_isxdigit 51 #define isblank posix_isblank 52 #define iscntrl posix_iscntrl 53 #define isgraph posix_isgraph 54 #define isprint posix_isprint 55 #define ispunct posix_ispunct 46 56 #endif 47 57
Note:
See TracChangeset
for help on using the changeset viewer.