diff options
| author | Zach DeCook <zachdecook@librem.one> | 2023-08-28 17:44:29 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2023-08-28 17:44:29 -0400 |
| commit | bb018bf3a2241f36217489e0d9b82d4715ef7b0f (patch) | |
| tree | 0a7c3a6e59e89db37c612d992ea47ba876682fa1 /swipeGuess.c | |
| parent | 0185d383d699a4dddd9237be7e1866f709134d42 (diff) | |
| download | swipeGuess-bb018bf3a2241f36217489e0d9b82d4715ef7b0f.tar.gz | |
swipeGuess: Add ignorechars
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); |
