return bin;
}
+static void
+mnemon_remove_bin (mnemon_t *mnemon,
+ bin_t *bin)
+{
+ int i = bin - mnemon->bins;
+
+ memmove (bin, bin + 1, (mnemon->num_bins - i) * sizeof (bin_t));
+ mnemon->num_bins--;
+}
+
static void
chomp (char *s)
{
printf ("%s\n", item->challenge);
response = readline ("> ");
- if (response == NULL)
+ if (response == NULL) {
+ printf ("\n");
break;
+ }
correct = (strcmp (response, item->response) == 0);
bin_remove_item (bin, item_index);
+ if (bin->num_items == 0)
+ mnemon_remove_bin (mnemon, bin);
if (correct) {
printf ("Correct!\n\n");
{
mnemon_t mnemon;
- srand (time (NULL));
+ srand (1);
mnemon_init (&mnemon);