ar_subs.c (c9a8d1f4ddce0e113129507ab55689b6e922f60d) | ar_subs.c (46be34b90213ebd9037cb2c24aec0009d7f2f5c1) |
---|---|
1/*- 2 * Copyright (c) 1992 Keith Muller. 3 * Copyright (c) 1992, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Keith Muller of the University of California, San Diego. 8 * --- 26 unchanged lines hidden (view full) --- 35 * SUCH DAMAGE. 36 */ 37 38#ifndef lint 39#if 0 40static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; 41#endif 42static const char rcsid[] = | 1/*- 2 * Copyright (c) 1992 Keith Muller. 3 * Copyright (c) 1992, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Keith Muller of the University of California, San Diego. 8 * --- 26 unchanged lines hidden (view full) --- 35 * SUCH DAMAGE. 36 */ 37 38#ifndef lint 39#if 0 40static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; 41#endif 42static const char rcsid[] = |
43 "$Id$"; | 43 "$Id: ar_subs.c,v 1.11 1998/05/15 06:27:36 charnier Exp $"; |
44#endif /* not lint */ 45 46#include <sys/types.h> 47#include <sys/time.h> 48#include <sys/stat.h> 49#include <signal.h> 50#include <string.h> 51#include <stdio.h> --- 197 unchanged lines hidden (view full) --- 249 * a bad name mod, skip and purge name from link table 250 */ 251 purg_lnk(arcn); 252 (void)rd_skip(arcn->skip + arcn->pad); 253 continue; 254 } 255 256 /* | 44#endif /* not lint */ 45 46#include <sys/types.h> 47#include <sys/time.h> 48#include <sys/stat.h> 49#include <signal.h> 50#include <string.h> 51#include <stdio.h> --- 197 unchanged lines hidden (view full) --- 249 * a bad name mod, skip and purge name from link table 250 */ 251 purg_lnk(arcn); 252 (void)rd_skip(arcn->skip + arcn->pad); 253 continue; 254 } 255 256 /* |
257 * Non standard -Y and -Z flag. When the exisiting file is | 257 * Non standard -Y and -Z flag. When the existing file is |
258 * same age or newer skip 259 */ 260 if ((Yflag || Zflag) && ((lstat(arcn->name, &sb) == 0))) { 261 if (Yflag && Zflag) { 262 if ((arcn->sb.st_mtime <= sb.st_mtime) && 263 (arcn->sb.st_ctime <= sb.st_ctime)) { 264 (void)rd_skip(arcn->skip + arcn->pad); 265 continue; --- 239 unchanged lines hidden (view full) --- 505 * pad as required, cnt is number of bytes not written 506 */ 507 if (((cnt > 0) && (wr_skip(cnt) < 0)) || 508 ((arcn->pad > 0) && (wr_skip(arcn->pad) < 0))) 509 break; 510 } 511 512 /* | 258 * same age or newer skip 259 */ 260 if ((Yflag || Zflag) && ((lstat(arcn->name, &sb) == 0))) { 261 if (Yflag && Zflag) { 262 if ((arcn->sb.st_mtime <= sb.st_mtime) && 263 (arcn->sb.st_ctime <= sb.st_ctime)) { 264 (void)rd_skip(arcn->skip + arcn->pad); 265 continue; --- 239 unchanged lines hidden (view full) --- 505 * pad as required, cnt is number of bytes not written 506 */ 507 if (((cnt > 0) && (wr_skip(cnt) < 0)) || 508 ((arcn->pad > 0) && (wr_skip(arcn->pad) < 0))) 509 break; 510 } 511 512 /* |
513 * tell format to write trailer; pad to block boundry; reset directory | 513 * tell format to write trailer; pad to block boundary; reset directory |
514 * mode/access times, and check if all patterns supplied by the user 515 * were matched. block off signals to avoid chance for multiple entry 516 * into the cleanup code 517 */ 518 if (wr_one) { 519 (*frmt->end_wr)(); 520 wr_fin(); 521 } --- 16 unchanged lines hidden (view full) --- 538 * Care is taken so that these do not end up as links to the older 539 * version of the same file already stored in the archive. It is expected 540 * when extraction occurs these newer versions will over-write the older 541 * ones stored "earlier" in the archive (this may be a bad assumption as 542 * it depends on the implementation of the program doing the extraction). 543 * It is really difficult to splice in members without either re-writing 544 * the entire archive (from the point were the old version was), or having 545 * assistance of the format specification in terms of a special update | 514 * mode/access times, and check if all patterns supplied by the user 515 * were matched. block off signals to avoid chance for multiple entry 516 * into the cleanup code 517 */ 518 if (wr_one) { 519 (*frmt->end_wr)(); 520 wr_fin(); 521 } --- 16 unchanged lines hidden (view full) --- 538 * Care is taken so that these do not end up as links to the older 539 * version of the same file already stored in the archive. It is expected 540 * when extraction occurs these newer versions will over-write the older 541 * ones stored "earlier" in the archive (this may be a bad assumption as 542 * it depends on the implementation of the program doing the extraction). 543 * It is really difficult to splice in members without either re-writing 544 * the entire archive (from the point were the old version was), or having 545 * assistance of the format specification in terms of a special update |
546 * header that invalidates a previous archive record. The posix spec left | 546 * header that invalidates a previous archive record. The POSIX spec left |
547 * the method used to implement -u unspecified. This pax is able to 548 * over write existing files that it creates. 549 */ 550 551#if __STDC__ 552void 553append(void) 554#else --- 8 unchanged lines hidden (view full) --- 563 int udev; 564 off_t tlen; 565 566 arcn = &archd; 567 orgfrmt = frmt; 568 569 /* 570 * Do not allow an append operation if the actual archive is of a | 547 * the method used to implement -u unspecified. This pax is able to 548 * over write existing files that it creates. 549 */ 550 551#if __STDC__ 552void 553append(void) 554#else --- 8 unchanged lines hidden (view full) --- 563 int udev; 564 off_t tlen; 565 566 arcn = &archd; 567 orgfrmt = frmt; 568 569 /* 570 * Do not allow an append operation if the actual archive is of a |
571 * different format than the user specified foramt. | 571 * different format than the user specified format. |
572 */ 573 if (get_arc() < 0) 574 return; 575 if ((orgfrmt != NULL) && (orgfrmt != frmt)) { 576 pax_warn(1, "Cannot mix current archive format %s with %s", 577 frmt->name, orgfrmt->name); 578 return; 579 } --- 79 unchanged lines hidden (view full) --- 659 * done, finish up read and get the number of bytes to back up so we 660 * can add new members. The format might have used the hard link table, 661 * purge it. 662 */ 663 tlen = (*frmt->end_rd)(); 664 lnk_end(); 665 666 /* | 572 */ 573 if (get_arc() < 0) 574 return; 575 if ((orgfrmt != NULL) && (orgfrmt != frmt)) { 576 pax_warn(1, "Cannot mix current archive format %s with %s", 577 frmt->name, orgfrmt->name); 578 return; 579 } --- 79 unchanged lines hidden (view full) --- 659 * done, finish up read and get the number of bytes to back up so we 660 * can add new members. The format might have used the hard link table, 661 * purge it. 662 */ 663 tlen = (*frmt->end_rd)(); 664 lnk_end(); 665 666 /* |
667 * try to postion for write, if this fails quit. if any error occurs, | 667 * try to position for write, if this fails quit. if any error occurs, |
668 * we will refuse to write 669 */ 670 if (appnd_start(tlen) < 0) 671 return; 672 673 /* 674 * tell the user we are done reading. 675 */ --- 565 unchanged lines hidden --- | 668 * we will refuse to write 669 */ 670 if (appnd_start(tlen) < 0) 671 return; 672 673 /* 674 * tell the user we are done reading. 675 */ --- 565 unchanged lines hidden --- |