diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-15 23:12:49 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-15 23:12:49 +0300 |
commit | 3697ec5ca140f686643d204a54181a5ddbf9a799 (patch) | |
tree | 592873e8614475012ddd5f4e6d0482acadbfc9e2 /missing.d/strchr.c | |
parent | f3d9dd233ac07f764a554528c85be3768a1d1ddb (diff) | |
download | egawk-3697ec5ca140f686643d204a54181a5ddbf9a799.tar.gz egawk-3697ec5ca140f686643d204a54181a5ddbf9a799.tar.bz2 egawk-3697ec5ca140f686643d204a54181a5ddbf9a799.zip |
Moved to gawk 2.11.
Diffstat (limited to 'missing.d/strchr.c')
-rw-r--r-- | missing.d/strchr.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/missing.d/strchr.c b/missing.d/strchr.c new file mode 100644 index 00000000..234ac883 --- /dev/null +++ b/missing.d/strchr.c @@ -0,0 +1,35 @@ +/* + * strchr --- search a string for a character + * + * We supply this routine for those systems that aren't standard yet. + */ + +char * +strchr (str, c) +register char *str, c; +{ + for (; *str; str++) + if (*str == c) + return str; + + return NULL; +} + +/* + * strrchr --- find the last occurrence of a character in a string + * + * We supply this routine for those systems that aren't standard yet. + */ + +char * +strrchr (str, c) +register char *str, c; +{ + register char *save = NULL; + + for (; *str; str++) + if (*str == c) + save = str; + + return save; +} |