1 diff -ru tar-1.11.8/lib/rx.h tar-1.11.8.1/lib/rx.h
2 --- tar-1.11.8/lib/rx.h Fri May 5 14:17:10 1995
3 +++ tar-1.11.8.1/lib/rx.h Fri May 5 14:17:10 1995
6 /* If this bit is set, then `{...}' defines an interval, and \{ and \}
8 - If not smt, then `\{...\}' defines an interval. */
9 + If not set, then `\{...\}' defines an interval. */
10 #define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
12 /* If this bit is set, (...) defines a group, and \( and \) are literals.
13 diff -ru tar-1.11.8/src/buffer.c tar-1.11.8.1/src/buffer.c
14 --- tar-1.11.8/src/buffer.c Mon May 29 02:26:27 1995
15 +++ tar-1.11.8.1/src/buffer.c Mon Feb 5 20:20:19 1996
17 /* Where we write messages (standard messages, not errors) to. Stdout
18 unless we're writing a pipe, in which case stderr. */
22 #define STDIN 0 /* standard input file descriptor */
23 #define STDOUT 1 /* standard output file descriptor */
25 static int childpid = 0;
27 /* Record number of the start of this block of records */
31 /* Error recovery stuff */
32 static int r_error_count;
35 open_archive (int reading)
37 - stdlis = flag_exstdout ? stderr : stdout;
38 + time_t start_time = time(0) ;
39 + stdrec = stdlis = flag_exstdout ? stderr : stdout;
40 + if ( record_file_name != NULL )
42 +#define INSERT_TIMESTAMP
43 +#ifdef INSERT_TIMESTAMP
45 + * A record-file name with '%T' will be expanded with a decimal
46 + * value for the timestamp of the archive. This is the time value
47 + * stored in the label record.
48 + * If you are using only one computer, this should be a unique number.
49 + * You are able to create different rec-files for all your archives,
50 + * as well as finding the index of your archive in a reliable way.
52 + * Another way would be to let us set the timestamp by another option.
53 + * tar --timestamp <ts-number> ...
56 + if ( reading == 0 ) {
57 + char*p= record_file_name ;
60 + while ( p[0] != '\0' ) {
61 + if ( p[0] == '%' && p[1] == 'T' ) {
62 + /* i += */ sprintf(rfn+i,"%d",start_time);
65 + } else { rfn[i++] = *p++ ; }
68 + } else strcpy(rfn,record_file_name);
70 + char*rfn=record_file_name;
72 + if ( ( stdrec = fopen(rfn,"w")) == NULL )
74 + fprintf(stdlis,"Cannot open %s.\n",record_file_name);
81 ERROR ((TAREXIT_FAILURE, 0, _("Invalid value for blocksize")));
83 + if ( ( flag_sayblock ) && ( flag_volhdr ) )
86 + "loc timestamp is %d \n",
89 + if ( flag_sayblock && (blocksize != 10240) )
92 + "loc block length is %d bytes = %d * 512 bytes \n",
93 + blocksize,blocksize>>9);
96 if (archive_names == 0)
97 ERROR ((TAREXIT_FAILURE, 0,
98 _("No archive name given, what should I do?")));
100 setmode (archive, O_BINARY);
103 +#if defined(MTIOCGET)
104 + /* Prints the file number of the archive */
105 + if ( flag_sayblock )
109 + i = ioctl(archive,MTIOCGET,&get);
110 + if (( i == 0 ) && ( get.mt_fileno >= 0 ))
113 + "loc number of the file is %d \n",
119 +#if defined(MTIOCPOS)
120 + /* Prints the tape block number on every Linux SCSI-device */
121 + if ( flag_sayblock )
125 + i = ioctl(archive,MTIOCPOS,&pos);
129 + "loc number of the first block is %d\n",
137 ar_last = ar_block; /* set up for 1st block = # 0 */
139 assign_string (¤t_file_name, ar_block->header.arch_name);
141 ar_block->header.linkflag = LF_VOLHDR;
142 - to_oct (time (0), 1 + 12, ar_block->header.mtime);
143 + to_oct (start_time , 1 + 12, ar_block->header.mtime);
144 finish_header (ar_block);
148 if (err != blocksize && !flag_multivol)
150 else if (flag_totals)
151 - tot_written += blocksize;
152 + tot_written += blocking;
155 bytes_written += err;
157 if (err != blocksize)
159 else if (flag_totals)
160 - tot_written += blocksize;
161 + tot_written += blocking;
164 bytes_written = blocksize;
165 diff -ru tar-1.11.8/src/create.c tar-1.11.8.1/src/create.c
166 --- tar-1.11.8/src/create.c Sat Jun 17 23:08:13 1995
167 +++ tar-1.11.8.1/src/create.c Sun Dec 1 01:55:08 1996
169 to_oct ((long) sum, 8, header->header.chksum);
170 header->header.chksum[6] = '\0'; /* zap the space */
173 + /* print header first to get the same output with 'tar -tvR'
176 + /* userec (header); */
181 head_standard = flag_standard;
189 diff -ru tar-1.11.8/src/extract.c tar-1.11.8.1/src/extract.c
190 --- tar-1.11.8/src/extract.c Sun Jun 11 15:40:21 1995
191 +++ tar-1.11.8.1/src/extract.c Sun Dec 1 01:55:28 1996
195 ERROR ((0, 0, _("Visible long name error")));
197 skip_file ((long) hstat.st_size);
200 diff -ru tar-1.11.8/src/list.c tar-1.11.8.1/src/list.c
201 --- tar-1.11.8/src/list.c Wed May 3 05:28:17 1995
202 +++ tar-1.11.8.1/src/list.c Sun Dec 1 16:22:12 1996
207 - check = fwrite (data, sizeof (char), written, stdlis);
208 + check = fwrite (data, sizeof (char), written, stdrec);
209 userec ((union record *) (data + written - 1));
210 if (check != written)
214 assign_string (&save_name, NULL);
215 saverec (NULL); /* unsave it */
216 - fputc ('\n', stdlis);
218 + fputc ('\n', stdrec);
224 longp = ((header->header.linkflag == LF_LONGNAME)
227 + assign_string (¤t_file_name, header->header.arch_name);
236 - fprintf (stdlis, _("rec %10ld: "), baserec + (ar_record - ar_block));
237 + fprintf (stdrec, _("rec %10ld: "), baserec + (ar_record - ar_block));
239 - annofile (stdlis, (char *) NULL);
240 + annofile (stdrec, (char *) NULL);
243 if (flag_verbose <= 1)
244 @@ -547,11 +549,11 @@
248 - fprintf (stdlis, "%s\n", quoted_name);
249 + fprintf (stdrec, "%s\n", quoted_name);
253 - fprintf (stdlis, "%s\n", current_file_name);
254 + fprintf (stdrec, "%s\n", current_file_name);
259 switch (head->header.linkflag)
262 + /* dirty bug fix to display the header processing
263 + * tar cvvf /dev/null --label 'hello world' blah...
264 + * J"org Weule weule@cs.uni-duesseldorf.de
266 + hstat.st_mtime = from_oct(1 + 12 , head->header.mtime);
274 + /*ERROR ((0, 0, _("Visible longname error")));*/
279 - ERROR ((0, 0, _("Visible longname error")));
280 + /*ERROR ((0, 0, _("Visible longname error")));*/
285 @@ -663,18 +675,18 @@
289 - fprintf (stdlis, "%s %s/%s %*s%s %s %s",
290 + fprintf (stdrec, "%s %s/%s %*s%s %s %s",
291 modes, user, group, ugswidth - pad, "",
292 size, timestamp + 4, timestamp + 20);
294 name = quote_copy_string (current_file_name);
297 - fprintf (stdlis, " %s", name);
298 + fprintf (stdrec, " %s", name);
302 - fprintf (stdlis, " %s", current_file_name);
303 + fprintf (stdrec, " %s", current_file_name);
305 switch (head->header.linkflag)
307 @@ -682,26 +694,26 @@
308 name = quote_copy_string (current_link_name);
311 - fprintf (stdlis, " -> %s\n", name);
312 + fprintf (stdrec, " -> %s\n", name);
316 - fprintf (stdlis, " -> %s\n", current_link_name);
317 + fprintf (stdrec, " -> %s\n", current_link_name);
321 name = quote_copy_string (current_link_name);
324 - fprintf (stdlis, _(" link to %s\n"), name);
325 + fprintf (stdrec, _(" link to %s\n"), name);
329 - fprintf (stdlis, _(" link to %s\n"), current_link_name);
330 + fprintf (stdrec, _(" link to %s\n"), current_link_name);
334 - fprintf (stdlis, _(" unknown file type `%c'\n"),
335 + fprintf (stdrec, _(" unknown file type `%c'\n"),
336 head->header.linkflag);
339 @@ -714,24 +726,32 @@
343 - putc ('\n', stdlis);
344 + putc ('\n', stdrec);
348 + fprintf (stdrec, _("--Long Name--\n"));
352 + fprintf (stdrec, _("--Long Link--\n"));
356 - fprintf (stdlis, _("--Volume Header--\n"));
357 + fprintf (stdrec, _("--Volume Header--\n"));
361 - fprintf (stdlis, _("--Continued at byte %ld--\n"),
362 + fprintf (stdrec, _("--Continued at byte %ld--\n"),
363 from_oct (1 + 12, head->header.offset));
367 - fprintf (stdlis, _("--Mangled file names--\n"));
368 + fprintf (stdrec, _("--Mangled file names--\n"));
376 /*--------------------------------------------------------------.
378 demode ((unsigned) mode, modes + 1);
381 - fprintf (stdlis, _("rec %10ld: "), baserec + (ar_record - ar_block));
382 + fprintf (stdrec, _("rec %10ld: "), baserec + (ar_record - ar_block));
384 - annofile (stdlis, (char *) NULL);
385 + annofile (stdrec, (char *) NULL);
387 name = quote_copy_string (pathname);
389 diff -ru tar-1.11.8/src/tar.c tar-1.11.8.1/src/tar.c
390 --- tar-1.11.8/src/tar.c Sat Jun 17 22:48:32 1995
391 +++ tar-1.11.8.1/src/tar.c Mon Apr 8 16:54:08 1996
393 #define OPTION_VOLNO_FILE 15
394 #define OPTION_COMPRESS_PROG 16
395 #define OPTION_RSH_COMMAND 17
396 +#define OPTION_RECORD_FILE 18
398 /* Some cleanup is made in GNU tar long options. Using old names will send
399 a warning to stderr. */
401 {"preserve-permissions", no_argument, NULL, 'p'},
402 {"read-full-blocks", no_argument, NULL, 'B'},
403 {"record-number", no_argument, NULL, 'R'},
404 + {"record-file", required_argument, NULL, OPTION_RECORD_FILE},
405 {"remove-files", no_argument, &flag_remove_files, 1},
406 {"rsh-command", required_argument, NULL, OPTION_RSH_COMMAND},
407 {"same-order", no_argument, NULL, 's'},
408 @@ -1059,6 +1061,7 @@
409 --checkpoint print directory names while reading the archive\n\
410 --totals print total bytes written while creating archive\n\
411 -R, --record-number show record number within archive with each message\n\
412 + --record-file print the record information to file, enable -R\n\
413 -w, --interactive ask for confirmation for every action\n\
414 --confirmation same as -w\n"),
416 @@ -1212,6 +1215,11 @@
417 flag_rsh_command = optarg;
420 + case OPTION_RECORD_FILE:
421 + record_file_name = optarg ;
422 + flag_sayblock++; /* Print block #s for debug */
426 /* We are making a GNU dump; save directories at the beginning
427 of the archive, and include in each directory its contents. */
428 @@ -1626,9 +1634,42 @@
433 + * Comment the next line out if you have problems. Joerg Weule
435 +#define PRINT_TROUPUT
436 +#ifdef PRINT_TROUPUT
437 + start_time = time(0);
440 + time_t end_time = time(0);
441 + double sec = end_time - start_time ;
442 + double t = ((double)tot_written) * RECORDSIZE ;
443 + fprintf (stderr, _("Total bytes written: %.0f"),t);
444 + if ( t >= 1e9 ) fprintf(stderr, _(" (%3.1f Gb)"),t/1e9 ); else
445 + if ( t >= 1e6 ) fprintf(stderr, _(" (%3.1f Mb)"),t/1e6 ); else
446 + if ( t >= 1024 ) fprintf(stderr, _(" (%3.1f Kb)"),t/1024 );
447 + fprintf(stderr,"\n");
449 + long s, m, h = sec ;
456 + fprintf (stderr, _("Elapsed time: %02d:%02d:%02d, %g sec\n"), h,m,s,sec);
457 + if ( !flag_multivol)
458 + fprintf (stderr, _("Throughput per second: %.0fKb/sec\n"),
465 - fprintf (stderr, _("Total bytes written: %d\n"), tot_written);
466 + fprintf (stderr, _("Total bytes written: %g\n")),
467 + ((double)tot_written) * RECORDSIZE );
471 case COMMAND_EXTRACT:
472 diff -ru tar-1.11.8/src/tar.h tar-1.11.8.1/src/tar.h
473 --- tar-1.11.8/src/tar.h Sat Jun 17 20:36:49 1995
474 +++ tar-1.11.8.1/src/tar.h Mon Feb 5 20:19:19 1996
479 +/* Time of writing. */
480 +GLOBAL time_t start_time;
482 /* Start of block of archive. */
483 GLOBAL union record *ar_block;
486 /* File containing names to work on. */
487 GLOBAL const char *namefile_name;
489 +/* File to write record information to. */
490 +GLOBAL char *record_file_name;
493 GLOBAL char filename_terminator;
496 /* Initial size of the sparsearray. */
497 GLOBAL int sp_array_size;
499 -/* Total written to output. */
500 -GLOBAL int tot_written;
501 +/* Total written to output in records. */
502 +GLOBAL long int tot_written;
504 /* Compiled regex for extract label. */
505 GLOBAL struct re_pattern_buffer *label_pattern;
510 +extern FILE *stdrec;
511 extern char *save_name;
512 extern long save_sizeleft;
513 extern long save_totsize;