Rev 2541 | Rev 2754 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2541 | Rev 2640 | ||
|---|---|---|---|
| Line 142... | Line 142... | ||
| 142 | 142 | ||
| 143 | return (a[c] - b[c]); |
143 | return (a[c] - b[c]); |
| 144 | 144 | ||
| 145 | } |
145 | } |
| 146 | 146 | ||
| - | 147 | int strncmp(const char *a, const char *b, size_t n) |
|
| - | 148 | { |
|
| - | 149 | size_t c = 0; |
|
| - | 150 | ||
| - | 151 | while (c < n && a[c] && b[c] && (!(a[c] - b[c]))) |
|
| - | 152 | c++; |
|
| - | 153 | ||
| - | 154 | return ( c < n ? a[c] - b[c] : 0); |
|
| - | 155 | ||
| - | 156 | } |
|
| 147 | 157 | ||
| 148 | /** Return pointer to the first occurence of character c in string |
158 | /** Return pointer to the first occurence of character c in string |
| 149 | * @param str scanned string |
159 | * @param str scanned string |
| 150 | * @param c searched character (taken as one byte) |
160 | * @param c searched character (taken as one byte) |
| 151 | * @return pointer to the matched character or NULL if it is not found in given string. |
161 | * @return pointer to the matched character or NULL if it is not found in given string. |