#include <stdio.h>
#include <stdlib.h>
#include <src/csb.h>
#define TRUE (1 == 1)
int main(void) {
csb_buf *buf = csb_new_withstring("abcDEFghi");
int retval;
if (buf == NULL) {
return (1);
}
printf("buffer contains: %s, position %d\n", csb_cstring(buf), (int)csb_tellpos(buf));
if (csb_searchbackward(buf, "DEF") == TRUE) {
printf("\tFound DEF, position %d\n", (int)csb_tellpos(buf));
retval = 0;
} else {
printf("\tERROR: did not find DEF.\n");
retval = 1;
}
csb_destroy(buf);
return (retval);
}
syntax highlighted by Code2HTML, v. 0.9.1