summaryrefslogtreecommitdiffstats
path: root/missing/strchr.c
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-20 02:22:50 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-20 02:22:50 +0000
commitf8f4a09e312afc9816e282c83449615ed146ea50 (patch)
tree35a33ab64f63da4a5d225cc309b8cee56b2e45cb /missing/strchr.c
parent2dd8bc29f1852c59d42731627341d209b420b6ab (diff)
downloadruby-f8f4a09e312afc9816e282c83449615ed146ea50.tar.gz
ruby-f8f4a09e312afc9816e282c83449615ed146ea50.tar.xz
ruby-f8f4a09e312afc9816e282c83449615ed146ea50.zip
* eval.c, file.c, ruby.c: removed strchr, strrchr, strstr definition
because they are defined in missing.h. * missing.h, missing/strchr.c, missing/strstr.c: ANSI styled. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing/strchr.c')
-rw-r--r--missing/strchr.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/missing/strchr.c b/missing/strchr.c
index 886d70ede..bebd7ba57 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;
}