- /* Called to write out the closing global volume number. */
- int
- closeout_volume_number ()
- {
- FILE *vf;
-
- vf = fopen (f_volno_file, "w");
- if (!vf)
- msg_perror ("%s", f_volno_file);
- else
- {
- fprintf (vf, "%d\n", global_volno);
- fclose (vf);
- }
- }
+ vf = fopen (f_volno_file, "r");
+ if (!vf && errno != ENOENT)
+ msg_perror ("%s", f_volno_file);
+
+ if (vf)
+ {
+ fscanf (vf, "%d", &global_volno);
+ fclose (vf);
+ }
+}
+
+/* Called to write out the closing global volume number. */
+void
+closeout_volume_number ()
+{
+ FILE *vf;
+
+ vf = fopen (f_volno_file, "w");
+ if (!vf)
+ msg_perror ("%s", f_volno_file);
+ else
+ {
+ fprintf (vf, "%d\n", global_volno);
+ fclose (vf);
+ }
+}
+
+/* We've hit the end of the old volume. Close it and open the next one */
+/* Values for type: 0: writing 1: reading 2: updating */
+int
+new_volume (type)
+ int type;
+{
+ int c;
+ char inbuf[80];
+ char *p;
+ static FILE *read_file = 0;
+ extern int now_verifying;
+ extern char TTY_NAME[];
+ static int looped = 0;
+
+ if (!read_file && !f_run_script_at_end)
+ read_file = (archive == 0) ? fopen (TTY_NAME, "r") : stdin;
+
+ if (now_verifying)
+ return -1;
+ if (f_verify)
+ verify_volume ();
+ if ((c = rmtclose (archive)) < 0)
+ msg_perror ("Warning: can't close %s(%d,%d)", ar_files[cur_ar_file], archive, c);
+
+ global_volno++;
+ volno++;
+ cur_ar_file++;
+ if (cur_ar_file == n_ar_files)
+ {
+ cur_ar_file = 0;
+ looped = 1;
+ }