#include <string.h>
#include "fortint.h"

fortint jmemcmp(
  unsigned char * buffer1,
  fortint * buffer1Offset,
  unsigned char * buffer2,
  fortint * buffer2Offset,
  fortint * numberOfBytesToCompare) {
int status;
int off1 = (int) (*buffer1Offset);
int off2 = (int) (*buffer2Offset);
size_t n = (size_t) *numberOfBytesToCompare;

  status = memcmp((buffer1+off1),(buffer2+off2),n);

  if( status != 0 )
    return (fortint) 1;
  else
    return (fortint) 0;

}

fortint jmemcmp_(
  unsigned char * buffer1,
  fortint * buffer1Offset,
  unsigned char * buffer2,
  fortint * buffer2Offset,
  fortint * numberOfBytesToCompare) {

  return jmemcmp(buffer1,buffer1Offset,buffer2,buffer2Offset,
                 numberOfBytesToCompare);
}
