From 5dbf8fc33f375c0453eb462fd44fa20f25867dd2 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Fri, 16 Mar 2018 19:37:43 -0400 Subject: [PATCH] search and display match offset --- main.cc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/main.cc b/main.cc index 0fbb9fa..7d72f85 100644 --- a/main.cc +++ b/main.cc @@ -21,11 +21,11 @@ int main(int argc, char * argv[]) return 1; } - static const char pattern[] = "\\= 0) + { + fprintf(stderr, "Match at offset %d\n", pos); + } + else if (pos == ONIG_MISMATCH) + { + fprintf(stderr, "No match!\n"); + } + else + { + fprintf(stderr, "Error!\n"); + } + onig_free(regex); return 0;