+
+ console_open(&outfp, &infd);
+
+ /*
+ * Preamble.
+ */
+ /* We only print the `name' caption if we have to... */
+ if (p->name_reqd && p->name) {
+ size_t l = strlen(p->name);
+ console_prompt_text(outfp, p->name, l);
+ if (p->name[l-1] != '\n')
+ console_prompt_text(outfp, "\n", 1);
+ }
+ /* ...but we always print any `instruction'. */
+ if (p->instruction) {
+ size_t l = strlen(p->instruction);
+ console_prompt_text(outfp, p->instruction, l);
+ if (p->instruction[l-1] != '\n')
+ console_prompt_text(outfp, "\n", 1);
+ }
+
+ for (curr_prompt = 0; curr_prompt < p->n_prompts; curr_prompt++) {
+
+ struct termios oldmode, newmode;
+ int i;
+ prompt_t *pr = p->prompts[curr_prompt];
+
+ tcgetattr(infd, &oldmode);