summaryrefslogtreecommitdiff
path: root/gnu/egcs/libiberty/bcmp.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>1999-05-26 13:38:57 +0000
committerMarc Espie <espie@cvs.openbsd.org>1999-05-26 13:38:57 +0000
commit0126e157b87f137fc08dc7f46f6c291b9d06ac5d (patch)
treef8555e3e504eb82b4cd3cba5cec20ae4ce8124ff /gnu/egcs/libiberty/bcmp.c
parentff8e9a4356e55ed142306c3a375fa280800abc86 (diff)
egcs projects compiler system
Exact copy of the snapshot, except for the removal of texinfo/ gcc/ch/ libchill/
Diffstat (limited to 'gnu/egcs/libiberty/bcmp.c')
-rw-r--r--gnu/egcs/libiberty/bcmp.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/gnu/egcs/libiberty/bcmp.c b/gnu/egcs/libiberty/bcmp.c
new file mode 100644
index 00000000000..11e4417db15
--- /dev/null
+++ b/gnu/egcs/libiberty/bcmp.c
@@ -0,0 +1,49 @@
+/* bcmp
+ This function is in the public domain. */
+
+/*
+
+NAME
+
+ bcmp -- compare two memory regions
+
+SYNOPSIS
+
+ int bcmp (char *from, char *to, int count)
+
+DESCRIPTION
+
+ Compare two memory regions and return zero if they are identical,
+ non-zero otherwise. If count is zero, return zero.
+
+NOTES
+
+ No guarantee is made about the non-zero returned value. In
+ particular, the results may be signficantly different than
+ strcmp(), where the return value is guaranteed to be less than,
+ equal to, or greater than zero, according to lexicographical
+ sorting of the compared regions.
+
+BUGS
+
+*/
+
+
+int
+bcmp (from, to, count)
+ char *from, *to;
+ int count;
+{
+ int rtnval = 0;
+
+ while (count-- > 0)
+ {
+ if (*from++ != *to++)
+ {
+ rtnval = 1;
+ break;
+ }
+ }
+ return (rtnval);
+}
+