ref: c22a7780da3799b1cc751260e772d26d20472479
parent: a2ad05f4e6b5d70ebf5c6b5db8a87172e7d44b5f
author: eli <eli@singularity>
date: Tue Mar 18 07:29:49 EDT 2025
rules?
--- a/anagrams.c
+++ b/anagrams.c
@@ -119,6 +119,7 @@
item *child;
int i;
int commonwords = 0;
+ int scrab = 0;
dict = calloc(1, sizeof(dlist));
@@ -134,11 +135,14 @@
}else if (argv[i][1] == 'c'){
commonwords = 1;
continue;
+ }else if (argv[i][1] == 's') {
+ scrab = 1;
+ continue;
}
}else continue;
USAGE:
- fprint(2, "usage: %s [-l[ength] minlen] [-c[ommonenglishwords] wordsfile\n", argv[0]);
+ fprint(2, "usage: %s [-l minlen] [-c] [-s] wordsfile\n", argv[0]);
exits("usage");
}
@@ -172,6 +176,17 @@
}
}
fclose(wordsfile);
+
+ if (scrab == 1) {
+ cur = dict;
+
+ while (cur->word != nil) {
+ printf("%s\n", cur->word);
+ cur = cur->next;
+ }
+
+ return;
+ }
items = calloc(1, sizeof(item));
items->input = strdup(input);
--
⑨