add a config file git-buildpackage
[debian/dds2tar] / tar-1.11.2.patch
1 diff -ru tar-1.11.2/ChangeLog tar-1.11.2.1/ChangeLog
2 --- tar-1.11.2/ChangeLog        Thu Mar 25 19:54:56 1993
3 +++ tar-1.11.2.1/ChangeLog      Mon Oct  3 21:07:15 1994
4 @@ -1,3 +1,16 @@
5 +Sat Jun 19 14:00:00 1994 J"org Weule (weule@cs.uni-duesseldorf.de)
6 +
7 +        * version.c: version 1.11.2 (added --record-file)
8 +
9 +        * create.c: print header before incrementing the record #
10 +
11 +       * tar.c: inserted the option --record-file
12 +
13 +       * buffer.c: opens the record file
14 +
15 +       * list.c: writes the record information to rec_files instead of
16 +       msg_file
17 +
18  Thu Mar 25 13:32:40 1993  Michael I Bushnell  (mib@geech.gnu.ai.mit.edu)
19  
20         * version.c: Released version 1.11.2.
21 diff -ru tar-1.11.2/buffer.c tar-1.11.2.1/buffer.c
22 --- tar-1.11.2/buffer.c Fri Mar 19 21:05:11 1993
23 +++ tar-1.11.2.1/buffer.c       Thu Feb  9 23:01:33 1995
24 @@ -62,6 +62,8 @@
25  /* Either stdout or stderr:  The thing we write messages (standard msgs, not
26     errors) to.  Stdout unless we're writing a pipe, in which case stderr */
27  FILE *msg_file = stdout;
28 +FILE *rec_file = stdout;
29 +char *rec_file_name = NULL ;
30  
31  #define        STDIN   0               /* Standard input  file descriptor */
32  #define        STDOUT  1               /* Standard output file descriptor */
33 @@ -115,7 +117,7 @@
34  /*
35   * Record number of the start of this block of records
36   */
37 -long baserec;
38 +long baserec = 0 ;
39  
40  /*
41   * Error recovery stuff
42 @@ -534,7 +536,44 @@
43  open_archive (reading)
44       int reading;
45  {
46 -  msg_file = f_exstdout ? stderr : stdout;
47 +  time_t start_time = time(0);
48 +  rec_file = msg_file = f_exstdout ? stderr : stdout;
49 +  if ( rec_file_name != NULL )
50 +    {
51 +#define INSERT_TIMESTAMP
52 +#ifdef INSERT_TIMESTAMP
53 +      /*
54 +       * A record-file name with '%T' will be expanded with a decimal
55 +       * value for the timestamp of the archive. This is the time value
56 +       * stored in the label record.
57 +       * If you are using only one computer, this should be a unique number.
58 +       * You are able to create different rec-files for all your archives,
59 +       * as well as finding the index of your archive in a reliable way.
60 +       *
61 +       * Another way would be to let us set the timestamp by another option.
62 +       * tar --timestamp <ts-number> ...
63 +       */
64 +      char rfn[256];
65 +      if ( reading == 0 ) {
66 +        char*p= rec_file_name ;
67 +        int i = 0 ;
68 +        int n;
69 +        while ( p[0] != '\0' ) {
70 +          if ( p[0] == '%' && p[1] == 'T' ) {
71 +            i += sprintf(rfn+i,"%d",start_time), p += 2 ;
72 +          } else { rfn[i++] = *p++ ; }
73 +        }
74 +        rfn[i] = '\0' ;
75 +      } else strcpy(rfn,rec_file_name);
76 +#else
77 +      char*rfn=rec_file_name;
78 +#endif
79 +      if ( ( rec_file = fopen(rfn,"w")) == NULL )
80 +        {
81 +          fprintf(rec_file,"Cannot open %s.\n",rec_file_name);
82 +          exit(1);
83 +        }
84 +    }
85  
86    if (blocksize == 0)
87      {
88 @@ -542,6 +581,19 @@
89        exit (EX_ARGSBAD);
90      }
91  
92 +  if ( ( f_sayblock ) && ( f_volhdr ) )
93 +    {
94 +      fprintf(rec_file,
95 +        "loc             timestamp is %d \n",
96 +        start_time);
97 +    }
98 +  if ( f_sayblock && (blocksize != 10240) )
99 +    {
100 +      fprintf(rec_file,
101 +        "loc             block length is %d bytes = %d * 512 bytes \n",
102 +        blocksize,blocksize>>9);
103 +    }
104 +
105    if (n_ar_files == 0)
106      {
107        msg ("No archive name given, what should I do?");
108 @@ -648,6 +700,38 @@
109    setmode (archive, O_BINARY);
110  #endif
111  
112 +#if defined(MTTELL)
113 +  /* Prints the file number of the archive */
114 +  if ( f_sayblock )
115 +    {
116 +      struct mtget get ;
117 +      int i ;
118 +      i = ioctl(archive,MTIOCGET,&get);
119 +      if (( i == 0 ) && ( get.mt_fileno >= 0 ))
120 +        {
121 +          fprintf(rec_file,
122 +            "loc             number of the file is %d \n",
123 +            get.mt_fileno );
124 +        }
125 +    }
126 +#endif
127 +
128 +#if defined(MTIOCPOS)
129 +  /* Prints the tape block number on every Linux SCSI-device */
130 +  if ( f_sayblock )
131 +    {
132 +      struct mtpos pos ;
133 +      int i ;
134 +      i = ioctl(archive,MTIOCPOS,&pos);
135 +      if ( i == 0 )
136 +        {
137 +          fprintf(rec_file,
138 +            "loc             number of the first block is %d\n",
139 +            pos.mt_blkno );
140 +        }
141 +    }
142 +#endif
143 +
144    if (reading)
145      {
146        ar_last = ar_block;      /* Set up for 1st block = # 0 */
147 @@ -700,7 +784,7 @@
148         strcpy (ar_block->header.arch_name, f_volhdr);
149        current_file_name = ar_block->header.arch_name;
150        ar_block->header.linkflag = LF_VOLHDR;
151 -      to_oct (time (0), 1 + 12, ar_block->header.mtime);
152 +      to_oct (start_time, 1 + 12, ar_block->header.mtime);
153        finish_header (ar_block);
154        /* ar_record++; */
155      }
156 diff -ru tar-1.11.2/create.c tar-1.11.2.1/create.c
157 --- tar-1.11.2/create.c Thu Mar 25 19:32:31 1993
158 +++ tar-1.11.2.1/create.c       Mon Oct  3 21:06:01 1994
159 @@ -1340,7 +1340,10 @@
160    to_oct ((long) sum, 8, header->header.chksum);
161    header->header.chksum[6] = '\0';     /* Zap the space */
162  
163 -  userec (header);
164 +  /* print header first to get the same output with 'tar -tvR'
165 +   * and 'tar -cvR'
166 +   */
167 +  /* userec (header); */
168  
169    if (f_verbose)
170      {
171 @@ -1353,6 +1356,8 @@
172        head_standard = f_standard;
173        print_header ();
174      }
175 +
176 +  userec (header);
177  
178    return;
179  }
180 diff -ru tar-1.11.2/list.c tar-1.11.2.1/list.c
181 --- tar-1.11.2/list.c   Tue Mar 16 20:56:01 1993
182 +++ tar-1.11.2.1/list.c Wed Oct 12 14:01:01 1994
183 @@ -48,6 +48,7 @@
184  #include "port.h"
185  
186  extern FILE *msg_file;
187 +extern FILE *rec_file;
188  
189  long from_oct ();              /* Decode octal number */
190  void demode ();                        /* Print file mode */
191 @@ -563,7 +564,7 @@
192    extern long baserec;
193  
194    if (f_sayblock)
195 -    fprintf (msg_file, "rec %10d: ", baserec + (ar_record - ar_block));
196 +    fprintf (rec_file, "rec %10d: ", baserec + (ar_record - ar_block));
197    /* annofile(msg_file, (char *)NULL); */
198  
199    if (f_verbose <= 1)
200 @@ -574,7 +575,7 @@
201        name = quote_copy_string (current_file_name);
202        if (name == 0)
203         name = current_file_name;
204 -      fprintf (msg_file, "%s\n", name);
205 +      fprintf (rec_file, "%s\n", name);
206        if (name != current_file_name)
207         free (name);
208      }
209 @@ -585,6 +586,11 @@
210        switch (head->header.linkflag)
211         {
212         case LF_VOLHDR:
213 +          /* dirty bug fix to display the header processing
214 +           * tar cvvf /dev/null --label 'hello world' blah...
215 +           * J"org Weule weule@cs.uni-duesseldorf.de
216 +           */
217 +          hstat.st_mtime = from_oct(1 + 12 , head->header.mtime);
218           modes[0] = 'V';
219           break;
220  
221 @@ -689,7 +695,7 @@
222        name = quote_copy_string (current_file_name);
223        if (!name)
224         name = current_file_name;
225 -      fprintf (msg_file, "%s %s/%s %*s%s %s %s %s",
226 +      fprintf (rec_file, "%s %s/%s %*s%s %s %s %s",
227                modes,
228                user,
229                group,
230 @@ -707,7 +713,7 @@
231           name = quote_copy_string (current_link_name);
232           if (!name)
233             name = current_link_name;
234 -         fprintf (msg_file, " -> %s\n", name);
235 +         fprintf (rec_file, " -> %s\n", name);
236           if (name != current_link_name)
237             free (name);
238           break;
239 @@ -716,13 +722,13 @@
240           name = quote_copy_string (current_link_name);
241           if (!name)
242             name = current_link_name;
243 -         fprintf (msg_file, " link to %s\n", current_link_name);
244 +         fprintf (rec_file, " link to %s\n", current_link_name);
245           if (name != current_link_name)
246             free (name);
247           break;
248  
249         default:
250 -         fprintf (msg_file, " unknown file type '%c'\n",
251 +         fprintf (rec_file, " unknown file type '%c'\n",
252                    head->header.linkflag);
253           break;
254  
255 @@ -735,23 +741,23 @@
256         case LF_FIFO:
257         case LF_CONTIG:
258         case LF_DUMPDIR:
259 -         putc ('\n', msg_file);
260 +         putc ('\n', rec_file);
261           break;
262  
263         case LF_VOLHDR:
264 -         fprintf (msg_file, "--Volume Header--\n");
265 +         fprintf (rec_file, "--Volume Header--\n");
266           break;
267  
268         case LF_MULTIVOL:
269 -         fprintf (msg_file, "--Continued at byte %ld--\n", from_oct (1 + 12, head->header.offset));
270 +         fprintf (rec_file, "--Continued at byte %ld--\n", from_oct (1 + 12, head->header.offset));
271           break;
272  
273         case LF_NAMES:
274 -         fprintf (msg_file, "--Mangled file names--\n");
275 +         fprintf (rec_file, "--Mangled file names--\n");
276           break;
277         }
278      }
279 -  fflush (msg_file);
280 +  fflush (rec_file);
281  }
282  
283  /*
284 @@ -774,12 +780,12 @@
285        demode ((unsigned) mode, modes + 1);
286  
287        if (f_sayblock)
288 -       fprintf (msg_file, "rec %10d: ", baserec + (ar_record - ar_block));
289 +       fprintf (rec_file, "rec %10d: ", baserec + (ar_record - ar_block));
290        /* annofile(msg_file, (char *)NULL); */
291        name = quote_copy_string (pathname);
292        if (!name)
293         name = pathname;
294 -      fprintf (msg_file, "%s %*s %.*s\n",
295 +      fprintf (rec_file, "%s %*s %.*s\n",
296                modes,
297                ugswidth + DATEWIDTH,
298                "Creating directory:",
299 diff -ru tar-1.11.2/tar.c tar-1.11.2.1/tar.c
300 --- tar-1.11.2/tar.c    Wed Mar 17 16:30:46 1993
301 +++ tar-1.11.2.1/tar.c  Thu Oct 13 00:48:14 1994
302 @@ -71,6 +71,8 @@
303  
304  
305  extern FILE *msg_file;
306 +extern FILE *rec_file;
307 +extern char *rec_file_name;
308  
309  int check_exclude ();
310  void add_exclude ();
311 @@ -122,6 +124,7 @@
312    {"null", 0, 0, 16},
313    {"directory", 1, 0, 'C'},
314    {"record-number", 0, &f_sayblock, 1},
315 +  {"record-file",1,0,19},
316    {"files-from", 1, 0, 'T'},
317    {"label", 1, 0, 'V'},
318    {"exclude-from", 1, 0, 'X'},
319 @@ -361,6 +364,11 @@
320           f_compressprog = optarg;
321           break;
322  
323 +       case 19:
324 +         rec_file_name = optarg ;
325 +         f_sayblock++;         /* Print block #s for debug */
326 +         break;
327 +
328         case 'g':               /* We are making a GNU dump; save
329                                    directories at the beginning of
330                                    the archive, and include in each
331 @@ -731,6 +739,7 @@
332  ", stdout);                    /* KLUDGE */
333    fputs ("\
334  -R, --record-number    show record number within archive with each message\n\
335 +--record-file           print the record information to file, enable -R\n\
336  --remove-files         remove files after adding them to the archive\n\
337  -s, --same-order,\n\
338      --preserve-order   list of names to extract is sorted to match archive\n\
339 diff -ru tar-1.11.2/version.c tar-1.11.2.1/version.c
340 --- tar-1.11.2/version.c        Thu Mar 25 19:35:25 1993
341 +++ tar-1.11.2.1/version.c      Mon Oct  3 16:01:59 1994
342 @@ -1 +1 @@
343 -char version_string[] = "GNU tar version 1.11.2";
344 +char version_string[] = "GNU tar version 1.11.2 (added --record-file)";