diff options
| author | manuel <manuel@mausz.at> | 2013-02-04 00:08:53 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-02-04 00:08:53 +0100 |
| commit | 69aec538b456402170dc723af417ba5c05389c32 (patch) | |
| tree | e6f34c543f17c6392447ea337b2e2868212424d1 /str_rchr.c | |
| download | qmail-69aec538b456402170dc723af417ba5c05389c32.tar.gz qmail-69aec538b456402170dc723af417ba5c05389c32.tar.bz2 qmail-69aec538b456402170dc723af417ba5c05389c32.zip | |
qmail 1.03 import
Diffstat (limited to 'str_rchr.c')
| -rw-r--r-- | str_rchr.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/str_rchr.c b/str_rchr.c new file mode 100644 index 0000000..1bf19d3 --- /dev/null +++ b/str_rchr.c | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #include "str.h" | ||
| 2 | |||
| 3 | unsigned int str_rchr(s,c) | ||
| 4 | register char *s; | ||
| 5 | int c; | ||
| 6 | { | ||
| 7 | register char ch; | ||
| 8 | register char *t; | ||
| 9 | register char *u; | ||
| 10 | |||
| 11 | ch = c; | ||
| 12 | t = s; | ||
| 13 | u = 0; | ||
| 14 | for (;;) { | ||
| 15 | if (!*t) break; if (*t == ch) u = t; ++t; | ||
| 16 | if (!*t) break; if (*t == ch) u = t; ++t; | ||
| 17 | if (!*t) break; if (*t == ch) u = t; ++t; | ||
| 18 | if (!*t) break; if (*t == ch) u = t; ++t; | ||
| 19 | } | ||
| 20 | if (!u) u = t; | ||
| 21 | return u - s; | ||
| 22 | } | ||
