Rev 4011 | Rev 4013 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4011 | Rev 4012 | ||
|---|---|---|---|
| Line 159... | Line 159... | ||
| 159 | while ((*dest++ = *src++) != '\0'); |
159 | while ((*dest++ = *src++) != '\0'); |
| 160 | 160 | ||
| 161 | return orig; |
161 | return orig; |
| 162 | } |
162 | } |
| 163 | 163 | ||
| - | 164 | /** Find first occurence of character in string. |
|
| - | 165 | * |
|
| - | 166 | * @param s String to search. |
|
| - | 167 | * @param i Character to look for. |
|
| - | 168 | * |
|
| - | 169 | * @return Pointer to character in @a s or NULL if not found. |
|
| - | 170 | */ |
|
| - | 171 | extern char *strchr(const char *s, int i) |
|
| - | 172 | { |
|
| - | 173 | while (*s != '\0') { |
|
| - | 174 | if (*s == i) return (char *) s; |
|
| - | 175 | ++s; |
|
| - | 176 | } |
|
| - | 177 | ||
| - | 178 | return NULL; |
|
| - | 179 | } |
|
| - | 180 | ||
| - | 181 | /** Find last occurence of character in string. |
|
| - | 182 | * |
|
| - | 183 | * @param s String to search. |
|
| - | 184 | * @param i Character to look for. |
|
| - | 185 | * |
|
| - | 186 | * @return Pointer to character in @a s or NULL if not found. |
|
| - | 187 | */ |
|
| - | 188 | extern char *strrchr(const char *s, int i) |
|
| - | 189 | { |
|
| - | 190 | const char *start; |
|
| - | 191 | ||
| - | 192 | start = s; |
|
| - | 193 | if (*s == '\0') return NULL; |
|
| - | 194 | ||
| - | 195 | while (*s != '\0') ++s; |
|
| - | 196 | ||
| - | 197 | while (s != start) { |
|
| - | 198 | --s; |
|
| - | 199 | if (*s == i) return (char *) s; |
|
| - | 200 | } |
|
| - | 201 | ||
| - | 202 | return NULL; |
|
| - | 203 | } |
|
| - | 204 | ||
| 164 | /** @} |
205 | /** @} |
| 165 | */ |
206 | */ |