summaryrefslogtreecommitdiff
path: root/missing
diff options
context:
space:
mode:
Diffstat (limited to 'missing')
-rw-r--r--missing/strchr.c18
-rw-r--r--missing/strstr.c11
2 files changed, 12 insertions, 17 deletions
diff --git a/missing/strchr.c b/missing/strchr.c
index 886d70ede6..bebd7ba578 100644
--- a/missing/strchr.c
+++ b/missing/strchr.c
@@ -1,32 +1,28 @@
/* public domain rewrite of strchr(3) and strrchr(3) */
char *
-strchr(s, c)
- char *s;
- int c;
+strchr(const char *s, int c)
{
- if (c == 0) return s + strlen(s);
+ if (c == 0) return (char *)s + strlen(s);
while (*s) {
if (*s == c)
- return s;
+ return (char *)s;
s++;
}
return 0;
}
char *
-strrchr(s, c)
- char *s;
- int c;
+strrchr(const char *s, int c)
{
- char *save;
+ const char *save;
- if (c == 0) return s + strlen(s);
+ if (c == 0) return (char *)s + strlen(s);
save = 0;
while (*s) {
if (*s == c)
save = s;
s++;
}
- return save;
+ return (char *)save;
}
diff --git a/missing/strstr.c b/missing/strstr.c
index 1673518f06..2e9c282fb1 100644
--- a/missing/strstr.c
+++ b/missing/strstr.c
@@ -1,20 +1,19 @@
/* public domain rewrite of strstr(3) */
char *
-strstr(haystack, needle)
- char *haystack, *needle;
+strstr(const char *haystack, const char *needle)
{
- char *hend;
- char *a, *b;
+ const char *hend;
+ const char *a, *b;
- if (*needle == 0) return haystack;
+ if (*needle == 0) return (char *)haystack;
hend = haystack + strlen(haystack) - strlen(needle) + 1;
while (haystack < hend) {
if (*haystack == *needle) {
a = haystack;
b = needle;
for (;;) {
- if (*b == 0) return haystack;
+ if (*b == 0) return (char *)haystack;
if (*a++ != *b++) {
break;
}