Date: Sat, 15 Jun 2019 07:23:06 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349048 - head/sbin/fsck_msdosfs Message-ID: <201906150723.x5F7N6ZY024308@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Sat Jun 15 07:23:06 2019 New Revision: 349048 URL: https://svnweb.freebsd.org/changeset/base/349048 Log: In ask(): override default option if any of alwaysyes/alwaysno/rdonly is set. MFC after: 2 weeks Modified: head/sbin/fsck_msdosfs/main.c Modified: head/sbin/fsck_msdosfs/main.c ============================================================================== --- head/sbin/fsck_msdosfs/main.c Sat Jun 15 06:51:46 2019 (r349047) +++ head/sbin/fsck_msdosfs/main.c Sat Jun 15 07:23:06 2019 (r349048) @@ -129,9 +129,10 @@ ask(int def, const char *fmt, ...) char prompt[256]; int c; + if (alwaysyes || alwaysno || rdonly) + def = (alwaysyes && !rdonly && !alwaysno); + if (preen) { - if (rdonly) - def = 0; if (def) printf("FIXED\n"); return def; @@ -140,9 +141,9 @@ ask(int def, const char *fmt, ...) va_start(ap, fmt); vsnprintf(prompt, sizeof(prompt), fmt, ap); va_end(ap); - if (alwaysyes || rdonly) { - printf("%s? %s\n", prompt, rdonly ? "no" : "yes"); - return !rdonly; + if (alwaysyes || alwaysno || rdonly) { + printf("%s? %s\n", prompt, def ? "yes" : "no"); + return def; } do { printf("%s? [yn] ", prompt);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906150723.x5F7N6ZY024308>