Simple utility to turn swipes into words -- "plugin" for wvkbd to enable swipe-typing under wayland SXMO.
Diffstat (limited to 'swipeGuess.c')
| -rw-r--r-- | swipeGuess.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/swipeGuess.c b/swipeGuess.c index 41fb29c..44881a7 100644 --- a/swipeGuess.c +++ b/swipeGuess.c @@ -6,6 +6,7 @@ #define BUFSIZE 1024 char wordBuff[BUFSIZE]; char swipeBuff[BUFSIZE]; +bool ignorechars[256] = {false}; // fgets, but without the newline. char *fgetst(char *restrict s, int size, FILE *restrict stream) { @@ -35,7 +36,7 @@ bool swipeCompare(char *swipe, char *word) { bool lastMatch = false; for(swipeP++; swipeP[0]; swipeP++) { lastMatch = false; - while (charcmp(swipeP[0], wordP[0])) { + while (charcmp(swipeP[0], wordP[0]) || ignorechars[wordP[0]]) { wordP++; lastMatch = true; } @@ -70,6 +71,11 @@ int main(int argc, char **argv) { if (argc >= 3) { n = atoi(argv[2]); } + if (argc >= 4) { + for(int i=0; argv[3][i];i++){ + ignorechars[(int)argv[3][0]] = true; + } + } FILE *wordFile = fopen(argv[1], "r"); while (fgetst(swipeBuff, BUFSIZE, stdin)) { query(wordFile, swipeBuff, n); |