aboutsummaryrefslogtreecommitdiffstats
path: root/missing.d/memcmp.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-15 23:12:49 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-15 23:12:49 +0300
commit3697ec5ca140f686643d204a54181a5ddbf9a799 (patch)
tree592873e8614475012ddd5f4e6d0482acadbfc9e2 /missing.d/memcmp.c
parentf3d9dd233ac07f764a554528c85be3768a1d1ddb (diff)
downloadegawk-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.c18
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);
+}