2007-08-01 13:00:15

by Bernd Schubert

[permalink] [raw]
Subject: [PATCH] e2fsck/e2fsprogs: answer yes/no to a group of questions

Hi,

saying yes or no to all e2fsck questions can be rather annoying (yes I
know -p and -y), so here's a patch to answer yes or no to a group of
questions.

Cheers,
Bernd


Attachments:
yes_no_to_all.patch (5.10 kB)

2007-08-02 15:09:53

by Andreas Dilger

[permalink] [raw]
Subject: Re: [PATCH] e2fsck/e2fsprogs: answer yes/no to a group of questions

On Aug 01, 2007 14:57 +0200, Bernd Schubert wrote:
> saying yes or no to all e2fsck questions can be rather annoying (yes I
> know -p and -y), so here's a patch to answer yes or no to a group of
> questions.

I've wanted something like this for quite a while already.

What would be more useful, however, is having the yes-to-all or no-to-all
apply to a particular problem instead of being generic. Otherwise it
isn't really different from using -y or -n. The reason that is useful
is that often there is a particular problem that should all be fixed or
skipped, but you want to be prompted how to fix a different problem type.

I haven't investigated, but maybe this could be implemented in the
same way as a latch for every problem?

> + if (ptr->flags & PR_YES_TO_ALL) {
> + printf("%s: yes\n", _(prompt[(int) ptr->prompt]));
> + return YES;
> + } else if (ptr->flags & PR_NO_TO_ALL) {
> + printf("%s: no\n", _(prompt[(int) ptr->prompt]));
> + return NO;
> + }

The "yes" and "no" here should be "_("yes")" and "_("no")" like in
ask() so they are translated.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

2007-08-02 16:32:42

by Bernd Schubert

[permalink] [raw]
Subject: Re: [PATCH] e2fsck/e2fsprogs: answer yes/no to a group of questions

Andreas Dilger wrote:

> On Aug 01, 2007 14:57 +0200, Bernd Schubert wrote:
>> saying yes or no to all e2fsck questions can be rather annoying (yes I
>> know -p and -y), so here's a patch to answer yes or no to a group of
>> questions.
>
> I've wanted something like this for quite a while already.
>
> What would be more useful, however, is having the yes-to-all or no-to-all
> apply to a particular problem instead of being generic. Otherwise it
> isn't really different from using -y or -n. The reason that is useful
> is that often there is a particular problem that should all be fixed or
> skipped, but you want to be prompted how to fix a different problem type.

But isn't that what the patch is going to do?

int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
{
...
ptr = find_problem(code); // So ptr is problem specific
}

Actually there was already everything prepared, it seems someone just forgot
to add a patch like this.

>
> I haven't investigated, but maybe this could be implemented in the
> same way as a latch for every problem?
>
>> + if (ptr->flags & PR_YES_TO_ALL) {
>> + printf("%s: yes\n", _(prompt[(int) ptr->prompt]));
>> + return YES;
>> + } else if (ptr->flags & PR_NO_TO_ALL) {
>> + printf("%s: no\n", _(prompt[(int) ptr->prompt]));
>> + return NO;
>> + }
>
> The "yes" and "no" here should be "_("yes")" and "_("no")" like in
> ask() so they are translated.

Thanks, going to correct this.


Cheers,
Bernd

2007-08-06 11:20:45

by Bernd Schubert

[permalink] [raw]
Subject: Re: [PATCH] e2fsck/e2fsprogs: answer yes/no to a group of questions

On Thursday 02 August 2007 00:28:56 Andreas Dilger wrote:
> The "yes" and "no" here should be "_("yes")" and "_("no")" like in
> ask() so they are translated.

Corrected version attached.

Signed-off-by: Bernd Schubert <[email protected]>


Cheers,
Bernd

--
Bernd Schubert
Q-Leap Networks GmbH


Attachments:
(No filename) (291.00 B)
yes_no_to_all.patch (5.12 kB)
Download all attachments