- /* 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;
- }
-
- tryagain:
- if (looped)
- {
- /* We have to prompt from now on. */
- if (f_run_script_at_end)
- system (info_script);
- else
- for (;;)
- {
- fprintf (msg_file, "\007Prepare volume #%d for %s and hit return: ", global_volno, ar_files[cur_ar_file]);
- fflush (msg_file);
- if (fgets (inbuf, sizeof (inbuf), read_file) == 0)
- {
- fprintf (msg_file, "EOF? What does that mean?");
- if (cmd_mode != CMD_EXTRACT && cmd_mode != CMD_LIST && cmd_mode != CMD_DIFF)
- msg ("Warning: Archive is INCOMPLETE!");
- exit (EX_BADARCH);
- }
- if (inbuf[0] == '\n' || inbuf[0] == 'y' || inbuf[0] == 'Y')
- break;
+ if (vf)
+ {
+ fscanf (vf, "%d", &global_volno);
+ fclose (vf);
+ }
+}
+
+/* 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);
+ }
+}
+
+/* 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;
+ }