-#ifdef DONTDEF
- /*
- * Message management.
- *
- * anno writes a message prefix on stream (eg stdout, stderr).
- *
- * The specified prefix is normally output followed by a colon and a space.
- * However, if other command line options are set, more output can come
- * out, such as the record # within the archive.
- *
- * If the specified prefix is NULL, no output is produced unless the
- * command line option(s) are set.
- *
- * If the third argument is 1, the "saved" record # is used; if 0, the
- * "current" record # is used.
- */
- void
- anno (stream, prefix, savedp)
- FILE *stream;
- char *prefix;
- int savedp;
- {
-# define MAXANNO 50
- char buffer[MAXANNO]; /* Holds annorecment */
-# define ANNOWIDTH 13
- int space;
- long offset;
- int save_e;
-
- save_e = errno;
- /* Make sure previous output gets out in sequence */
- if (stream == stderr)
- fflush (stdout);
- if (f_sayblock)
- {
- if (prefix)
- {
- fputs (prefix, stream);
- putc (' ', stream);
- }
- offset = ar_record - ar_block;
- (void) sprintf (buffer, "rec %d: ",
- savedp ? saved_recno :
- baserec + offset);
- fputs (buffer, stream);
- space = ANNOWIDTH - strlen (buffer);
- if (space > 0)
+void
+init_volume_number (void)
+{
+ FILE *file = fopen (volno_file_option, "r");
+
+ if (file)
+ {
+ fscanf (file, "%d", &global_volno);
+ if (fclose (file) == EOF)
+ ERROR ((0, errno, "%s", volno_file_option));
+ }
+ else if (errno != ENOENT)
+ ERROR ((0, errno, "%s", volno_file_option));
+}
+
+/*-------------------------------------------------------.
+| Called to write out the closing global volume number. |
+`-------------------------------------------------------*/
+
+void
+closeout_volume_number (void)
+{
+ FILE *file = fopen (volno_file_option, "w");
+
+ if (file)
+ {
+ fprintf (file, "%d\n", global_volno);
+ if (fclose (file) == EOF)
+ ERROR ((0, errno, "%s", volno_file_option));
+ }
+ else
+ ERROR ((0, errno, "%s", volno_file_option));
+}
+
+/*-----------------------------------------------------------------------.
+| We've hit the end of the old volume. Close it and open the next one. |
+| Return nonzero on success. |
+`-----------------------------------------------------------------------*/
+
+static int
+new_volume (enum access_mode access)
+{
+ static FILE *read_file;
+ static int looped;
+
+ int status;
+
+ if (!read_file && !info_script_option)
+ /* FIXME: if fopen is used, it will never be closed. */
+ read_file = archive == STDIN_FILENO ? fopen (TTY_NAME, "r") : stdin;
+
+ if (now_verifying)
+ return 0;
+ if (verify_option)
+ verify_volume ();
+
+ if (status = rmtclose (archive), status < 0)
+ WARN ((0, errno, _("WARNING: Cannot close %s (%d, %d)"),
+ *archive_name_cursor, archive, status));
+
+ global_volno++;
+ volno++;
+ archive_name_cursor++;
+ if (archive_name_cursor == archive_name_array + archive_names)
+ {
+ archive_name_cursor = archive_name_array;
+ looped = 1;
+ }
+
+ tryagain:
+ if (looped)
+ {
+ /* We have to prompt from now on. */
+
+ if (info_script_option)
+ {
+ if (volno_file_option)
+ closeout_volume_number ();
+ system (info_script_option);
+ }
+ else
+ while (1)