Mercurial > hg > index.cgi
comparison lwar/replace.c @ 431:6df8d62302e2
Fix error in --nopaths lwar option when replacing members
Fix missing logic update to handle --nopaths when replacing archive members.
author | David Flamand <dlflamand@gmail.com> |
---|---|
date | Wed, 16 Nov 2016 19:36:16 -0700 |
parents | 45df37e81741 |
children |
comparison
equal
deleted
inserted
replaced
430:e34c8bd6ea29 | 431:6df8d62302e2 |
---|---|
151 // done with the original file | 151 // done with the original file |
152 fclose(f); | 152 fclose(f); |
153 doadd: | 153 doadd: |
154 for (i = 0; i < nfiles; i++) | 154 for (i = 0; i < nfiles; i++) |
155 { | 155 { |
156 filename = get_file_name(files[i]); | 156 f2 = fopen(files[i], "rb"); |
157 f2 = fopen(filename, "rb"); | |
158 if (!f2) | 157 if (!f2) |
159 { | 158 { |
160 fprintf(stderr, "Cannot open file %s:", filename); | 159 fprintf(stderr, "Cannot open file %s:", files[i]); |
161 perror(""); | 160 perror(""); |
162 exit(1); | 161 exit(1); |
163 } | 162 } |
164 (void)(fread(buf, 1, 6, f2) && 1); | 163 (void)(fread(buf, 1, 6, f2) && 1); |
165 if (mergeflag && !memcmp("LWAR1V", buf, 6)) | 164 if (mergeflag && !memcmp("LWAR1V", buf, 6)) |
221 continue; | 220 continue; |
222 } | 221 } |
223 fseek(f2, 0, SEEK_END); | 222 fseek(f2, 0, SEEK_END); |
224 l = ftell(f2); | 223 l = ftell(f2); |
225 fseek(f2, 0, SEEK_SET); | 224 fseek(f2, 0, SEEK_SET); |
226 fputs(filename, nf); | 225 fputs(get_file_name(files[i]), nf); |
227 fputc(0, nf); | 226 fputc(0, nf); |
228 fputc(l >> 24, nf); | 227 fputc(l >> 24, nf); |
229 fputc((l >> 16) & 0xff, nf); | 228 fputc((l >> 16) & 0xff, nf); |
230 fputc((l >> 8) & 0xff, nf); | 229 fputc((l >> 8) & 0xff, nf); |
231 fputc(l & 0xff, nf); | 230 fputc(l & 0xff, nf); |