+ int unlearned;
+ int i;
+
+ /* Count the number of items with negative counts. */
+ unlearned = 0;
+ for (i = 0; i < mnemon->num_bins; i++) {
+ bin = &mnemon->bins[i];
+ if (bin->count >= 0)
+ break;
+ unlearned += bin->num_items;
+ }
+
+ to_introduce -= unlearned;
+ if (to_introduce < 0)
+ to_introduce = 0;
+
+ if (unlearned) {
+ printf ("You've got %d items to learn already. ", unlearned);
+ if (to_introduce)
+ printf ("I'll introduce %d more as we go.", to_introduce);
+ printf ("\n");
+ } else {
+ printf ("Introducing %d new items.\n", to_introduce);
+ }
+ printf ("\n");
+
+ do {
+ do {
+ mnemon_select_item (mnemon, &bin, &item_index);
+ } while (bin->count == 0 && to_introduce == 0);
+
+ if (bin->count == 0)
+ to_introduce--;