From: Sergey Poznyakoff Date: Mon, 22 May 2006 10:02:23 +0000 (+0000) Subject: (change_tape_menu): Break the loop after obtaining new archive name. Check for empty... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=a46704b1bf048e04f0dbe6e46a53cb04a4bf294f;p=chaz%2Ftar (change_tape_menu): Break the loop after obtaining new archive name. Check for empty input line --- diff --git a/src/buffer.c b/src/buffer.c index d788b16..df348ec 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -874,8 +874,9 @@ change_tape_menu (FILE *read_file) { char *input_buffer = NULL; size_t size = 0; - - while (1) + bool stop; + + while (!stop) { fputc ('\007', stderr); fprintf (stderr, @@ -905,7 +906,7 @@ change_tape_menu (FILE *read_file) case '?': { fprintf (stderr, _("\ - n [name] Give a new file name for the next (and subsequent) volume(s)\n\ + n name Give a new file name for the next (and subsequent) volume(s)\n\ q Abort tar\n\ y or newline Continue operation\n")); if (!restrict_option) @@ -942,8 +943,15 @@ change_tape_menu (FILE *read_file) ; *cursor = '\0'; - /* FIXME: the following allocation is never reclaimed. */ - *archive_name_cursor = xstrdup (name); + if (name[0]) + { + /* FIXME: the following allocation is never reclaimed. */ + *archive_name_cursor = xstrdup (name); + stop = true; + } + else + fprintf (stderr, "%s", + _("File name not specified. Try again.\n")); } break;