The convert utility doesn't need lots of fancy processing when
it asks the question of whether to proceed or not. As a result
most of the code thats there can be removed.
One thought that occurred to me was whether we should block
SIGINT like we do with fsck, during operation. That can be
a separate patch though, and it would be much simpler since there
is no reason to prompt the user as to whether to continue or not
in the conversion case, since a partial conversion would be useless.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
opts->query = TRUE;
while (1) {
- va_start(args, format);
- vprintf(format, args);
- va_end(args);
-
+ printf(_("Convert %s from GFS1 to GFS2? (y/n)"), dev);
/* Make sure query is printed out */
fflush(NULL);
- response = gfs2_getch();
-
+ fgets(response, 3, stdin);
printf("
");
fflush(NULL);
- if (response == 0x3) { /* if interrupted, by ctrl-c */
-
- /*This is ok to translate if nobody changes the (a/c) option.
- * Should we proceed with this translation */
- response = generic_interrupt(_("Question"), _("response"),
- NULL,
- _("Do you want to abort "
- "or continue (a/c)?"),
- "ac");
- if (response == 'a') {
- ret = 0;
- *setonabort = 1;
- break;
- }
- printf(_("Continuing.
"));
- } else if(tolower(response) == 'y') {
- ret = 1;
- break;
- } else if (tolower(response) == 'n') {
- ret = 0;
+ response[1] = 0;
+ ret = rpmatch(response);
+
+ if (ret >= 0)
break;
- } else {
- printf(_("Bad response %d, please type 'y' or 'n'.
"),
- response);
- }
+ printf(_("Bad response '%s', please type 'y' or 'n'.
"), response);
}
opts->query = FALSE;
@@ -2217,12 +2116,8 @@ int main(int argc, char **argv)
/* Make them seal their fate. */
/* ---------------------------------------------- */
if (!error) {
- int do_abort;
-
give_warning();
- if (!gfs2_query(&do_abort, &opts,
- _("Convert %s from GFS1 to GFS2? (y/n)"),
- device)) {
+ if (!gfs2_query(&opts, device)) {
log_crit(_("%s not converted.
"), device);
close(sb2.device_fd);
exit(0);