deps/kb_meme/meme-5.0.1/src/buffer.c
/*
 * buf_fread_unexpected
 * checks that the specified string follows exactly. If what follows is
 * unexpected then return 1, otherwise advance the buffer to skip over 
 * the expected string and return 0.
 *
 * Errors
 * The expected string must be smaller than the buffer or this will 
 * cause a fatal error. If a file read error occurs than it returns -1;
 */
buf_fread_unexpected
checks that the specified string follows exactly. If what follows is
unexpected then return 1, otherwise advance the buffer to skip over
the expected string and return 0.

Errors
The expected string must be smaller than the buffer or this will
cause a fatal error. If a file read error occurs than it returns -1.
buf_fread_unexpected checks that the specified string follows exactly . If what follows is unexpected then return 1 otherwise advance the buffer to skip over the expected string and return 0 . Errors The expected string must be smaller than the buffer or this will cause a fatal error . If a file read error occurs than it returns - 1 .
int buf_fread_unexpected(BUF_T *buf, FILE *fp, char *expected, bool ignorecase) {
  int i;
  i = buf->position;
  while (*expected != '\0') {
    while (i == buf->limit) {
      i -= buf->position;
      buf_compact(buf);
      if (buf_remaining(buf) == 0)
        die("buf_fread_unexpected() - expected string is longer than the buffer\n");
      if (feof(fp)) { 
        buf_flip(buf);
        return 1;
      }
      buf_fread(buf, fp);
      buf_flip(buf);
      if (ferror(fp)) return -1;
    }
    if (ignorecase) {
      if (tolower(buf->buffer[i]) != tolower(*expected)) return 1;
    } else {
      if (buf->buffer[i] != *expected) return 1;
    }
    ++i;
    ++expected;
  }
  buf->position = i;
  return 0;
}
int buf_fread_unexpected ( BUF_T * buf , FILE * fp , char * expected , bool ignorecase ) { int i ; i = buf -> position ; while ( * expected != ' \0 ' ) { while ( i == buf -> limit ) { i -= buf -> position ; buf_compact ( buf ) ; if ( buf_remaining ( buf ) == 0 ) die ( " \n " ) ; if ( feof ( fp ) ) { buf_flip ( buf ) ; return 1 ; } buf_fread ( buf , fp ) ; buf_flip ( buf ) ; if ( ferror ( fp ) ) return -1 ; } if ( ignorecase ) { if ( tolower ( buf -> buffer [ i ] ) != tolower ( * expected ) ) return 1 ; } else { if ( buf -> buffer [ i ] != * expected ) return 1 ; } ++ i ; ++ expected ; } buf -> position = i ; return 0 ; }
buf_fread_unexpected
 checks that the specified string follows exactly.
buf_fread_unexpected checks that the specified string follows exactly .
//no more to read and still not matched