[Toybox] [PATCH] Make yesno printf-like.
Rob Landley
rob at landley.net
Tue Sep 1 23:26:14 PDT 2015
On 09/01/2015 08:35 PM, enh wrote:
> Make yesno printf-like.
This just makes me uncomfortable that it's nonobvious enough somebody's
going to yesno(1, usersupplieddata);.
You never reprompt for yesno so printing arbitrarily complex prompt
could be the caller's job. That was intentional.
> In addition to making most existing code slightly simpler, this will
> let us move "if (!isatty(0)) return def;" into yesno so we can avoid
> printing a prompt in non-interactive situations.
Except you don't want to do that without a flag of its own:
$ cp -a lib bloit
$ cat | rm -ri bloit | cat
rm: descend into directory ‘bloit’? y
rm: remove regular file ‘bloit/help.c’? y
That's the ubuntu implementation, not mine, so if it's wrong it's at
least definitively wrong. :) Suppressing the prompt has to be done on a
per-case basis.
Let me think about it a bit...
Rob
1441175174.0
More information about the Toybox
mailing list