- prompt_re = compile_re ("(assword)|([#$])");
- switch (mexp_expect (h, prompt_re, NULL, 0, ovector, ovecsize, &pcre_err)) {
+ prompt_re = compile_re ("[#$]");
+ switch (mexp_expect (h,
+ (mexp_regexp[]) {
+ { 100, .re = password_re },
+ { 101, .re = prompt_re },
+ { 0 },
+ },
+ ovector, ovecsize)) {
+ case 100: /* Password. */
+ fprintf (stderr, "error: ssh asked for password again, probably the password supplied is wrong\n");
+ goto error;
+ case 101: /* Prompt. */
+ break;