Changeset 0ffbed9 in mainline for uspace/lib/posix/strings.c
- Timestamp:
- 2011-06-19T17:49:29Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5974661
- Parents:
- f48b637 (diff), 32fb6944 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/strings.c
rf48b637 r0ffbed9 1 1 /* 2 2 * Copyright (c) 2011 Jiri Zarevucky 3 * Copyright (c) 2011 Petr Koupy 3 4 * All rights reserved. 4 5 * … … 33 34 */ 34 35 35 #define POSIX_INTERNAL36 #define LIBPOSIX_INTERNAL 36 37 37 #include " common.h"38 #include "internal/common.h" 38 39 #include "strings.h" 39 40 #include "string.h" 41 #include "ctype.h" 40 42 43 /** 44 * 45 * @param i 46 * @return 47 */ 41 48 int posix_ffs(int i) 42 49 { … … 45 52 } 46 53 54 /** 55 * 56 * @param s1 57 * @param s2 58 * @return 59 */ 47 60 int posix_strcasecmp(const char *s1, const char *s2) 48 61 { 49 // TODO 50 not_implemented(); 62 return posix_strncasecmp(s1, s2, STR_NO_LIMIT); 51 63 } 52 64 65 /** 66 * 67 * @param s1 68 * @param s2 69 * @param n 70 * @return 71 */ 53 72 int posix_strncasecmp(const char *s1, const char *s2, size_t n) 54 73 { 55 // TODO 56 not_implemented(); 74 for (size_t i = 0; i < n; ++i) { 75 int cmp = tolower(s1[i]) - tolower(s2[i]); 76 if (cmp != 0) { 77 return cmp; 78 } 79 80 if (s1[i] == 0) { 81 return 0; 82 } 83 } 84 85 return 0; 57 86 } 58 87 88 /** 89 * 90 * @param mem1 91 * @param mem2 92 * @param n 93 * @return 94 */ 59 95 int posix_bcmp(const void *mem1, const void *mem2, size_t n) 60 96 { … … 63 99 } 64 100 101 /** 102 * 103 * @param dest 104 * @param src 105 * @param n 106 */ 65 107 void posix_bcopy(const void *dest, void *src, size_t n) 66 108 { … … 69 111 } 70 112 113 /** 114 * 115 * @param mem 116 * @param n 117 */ 71 118 void posix_bzero(void *mem, size_t n) 72 119 { … … 75 122 } 76 123 124 /** 125 * 126 * @param s 127 * @param c 128 * @return 129 */ 77 130 char *posix_index(const char *s, int c) 78 131 { … … 80 133 } 81 134 135 /** 136 * 137 * @param s 138 * @param c 139 * @return 140 */ 82 141 char *posix_rindex(const char *s, int c) 83 142 { … … 87 146 /** @} 88 147 */ 89
Note:
See TracChangeset
for help on using the changeset viewer.