|
|
1.1 ! root 1: /* Emulate bcmp using memcmp ! 2: Copyright (C) 1991 Free Software Foundation, Inc. ! 3: ! 4: This file is part of the libiberty library. ! 5: Libiberty is free software; you can redistribute it and/or ! 6: modify it under the terms of the GNU Library General Public ! 7: License as published by the Free Software Foundation; either ! 8: version 2 of the License, or (at your option) any later version. ! 9: ! 10: Libiberty is distributed in the hope that it will be useful, ! 11: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! 13: Library General Public License for more details. ! 14: ! 15: You should have received a copy of the GNU Library General Public ! 16: License along with libiberty; see the file COPYING.LIB. If ! 17: not, write to the Free Software Foundation, Inc., 675 Mass Ave, ! 18: Cambridge, MA 02139, USA. */ ! 19: ! 20: ! 21: /* ! 22: ! 23: NAME ! 24: ! 25: bcmp -- compare two memory regions ! 26: ! 27: SYNOPSIS ! 28: ! 29: int bcmp (char *from, char *to, int count) ! 30: ! 31: DESCRIPTION ! 32: ! 33: Compare two memory regions and return zero if they are identical, ! 34: non-zero otherwise. If count is zero, return zero. ! 35: ! 36: NOTES ! 37: ! 38: No guarantee is made about the non-zero returned value. In ! 39: particular, the results may be signficantly different than ! 40: strcmp(), where the return value is guaranteed to be less than, ! 41: equal to, or greater than zero, according to lexicographical ! 42: sorting of the compared regions. ! 43: ! 44: BUGS ! 45: ! 46: */ ! 47: ! 48: ! 49: int ! 50: bcmp (from, to, count) ! 51: char *from, *to; ! 52: int count; ! 53: { ! 54: int rtnval = 0; ! 55: ! 56: while (count-- > 0) ! 57: { ! 58: if (*from++ != *to++) ! 59: { ! 60: rtnval = 1; ! 61: break; ! 62: } ! 63: } ! 64: return (rtnval); ! 65: } ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.