aboutsummaryrefslogtreecommitdiff
path: root/gnu/libexec/uucp/libuucp/strrch.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/libexec/uucp/libuucp/strrch.c')
-rw-r--r--gnu/libexec/uucp/libuucp/strrch.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/libuucp/strrch.c b/gnu/libexec/uucp/libuucp/strrch.c
new file mode 100644
index 000000000000..a88e4b4358ba
--- /dev/null
+++ b/gnu/libexec/uucp/libuucp/strrch.c
@@ -0,0 +1,24 @@
+/* strrch.c
+ Look for the last occurrence of a character in a string. This is
+ supposed to work for a null byte, although we never actually call
+ it with one. */
+
+#include "uucp.h"
+
+char *
+strrchr (z, b)
+ const char *z;
+ int b;
+{
+ char *zret;
+
+ b = (char) b;
+ zret = NULL;
+ do
+ {
+ if (*z == b)
+ zret = (char *) z;
+ }
+ while (*z++ != '\0');
+ return zret;
+}