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/memcmp.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/memcmp.c')
-rw-r--r-- | missing.d/memcmp.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/missing.d/memcmp.c b/missing.d/memcmp.c new file mode 100644 index 00000000..e39c10ec --- /dev/null +++ b/missing.d/memcmp.c @@ -0,0 +1,18 @@ +/* + * memcmp --- compare strings. + * + * We use our own routine since it has to act like strcmp() for return + * value, and the BSD manual says bcmp() only returns zero/non-zero. + */ + +int +memcmp (s1, s2, l) +register char *s1, *s2; +register int l; +{ + for (; l--; s1++, s2++) { + if (*s1 != *s2) + return (*s1 - *s2); + } + return (*--s1 - *--s2); +} |