home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / DLIBSSRC.ZIP / BLKCMP.C < prev    next >
Encoding:
Text File  |  1987-06-14  |  454 b   |  21 lines

  1. int blkcmp(blk1, blk2, len)
  2. register char *blk1;
  3. register char *blk2;
  4. register int len;
  5. /*
  6.  *    Lexicographically compare the two blocks.  Return a value
  7.  *    indicating the relationship between the blocks.  Possible
  8.  *    return values are:
  9.  *        negative    blk1 < blk2
  10.  *        0        blk1 == blk2
  11.  *        positive    blk1 > blk2
  12.  *    <len> bytes are always compared.
  13.  */
  14. {
  15.     while((--len) && (*blk1 == *blk2)) {
  16.         ++blk1;
  17.         ++blk2;
  18.     }
  19.     return(*blk1 - *blk2);
  20. }
  21.