|
|
1.1 ! root 1: /* $Source: /src386/usr/bin/pax/append.c,v $ ! 2: * ! 3: * $Revision: 1.1 $ ! 4: * ! 5: * append.c - append to a tape archive. ! 6: * ! 7: * DESCRIPTION ! 8: * ! 9: * Routines to allow appending of archives ! 10: * ! 11: * AUTHORS ! 12: * ! 13: * Mark H. Colburn, NAPS International ([email protected]) ! 14: * ! 15: * ! 16: * Sponsored by The USENIX Association for public distribution. ! 17: * ! 18: * Copyright (c) 1989 Mark H. Colburn. ! 19: * All rights reserved. ! 20: * ! 21: * Redistribution and use in source and binary forms are permitted ! 22: * provided that the above copyright notice is duplicated in all such ! 23: * forms and that any documentation, advertising materials, and other ! 24: * materials related to such distribution and use acknowledge that the ! 25: * software was developed * by Mark H. Colburn and sponsored by The ! 26: * USENIX Association. ! 27: * ! 28: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 29: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 30: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 31: * ! 32: * $Log: append.c,v $ ! 33: * Revision 1.1 92/08/28 08:01:54 bin ! 34: * Initial revision ! 35: * ! 36: * Revision 1.1 89/02/14 16:47:35 jep ! 37: * Initial revision ! 38: * ! 39: * Revision 1.1 88/12/23 18:02:00 mark ! 40: * Initial revision ! 41: * ! 42: */ ! 43: ! 44: #ifndef lint ! 45: static char *ident = "$Id: append.c,v 1.1 92/08/28 08:01:54 bin Exp Locker: bin $"; ! 46: static char *copyright = "Copyright (c) 1989 Mark H. Colburn.\nAll rights reserved.\n"; ! 47: #endif /* ! lint */ ! 48: ! 49: ! 50: /* Headers */ ! 51: ! 52: #include "pax.h" ! 53: ! 54: ! 55: /* append_archive - main loop for appending to a tar archive ! 56: * ! 57: * DESCRIPTION ! 58: * ! 59: * Append_archive reads an archive until the end of the archive is ! 60: * reached once the archive is reached, the buffers are reset and the ! 61: * create_archive function is called to handle the actual writing of ! 62: * the appended archive data. This is quite similar to the ! 63: * read_archive function, however, it does not do all the processing. ! 64: */ ! 65: ! 66: #if __STDC__ ! 67: ! 68: void append_archive(void) ! 69: ! 70: #else ! 71: ! 72: void append_archive() ! 73: ! 74: #endif ! 75: { ! 76: Stat sb; ! 77: char name[PATH_MAX + 1]; ! 78: ! 79: name[0] = '\0'; ! 80: while (get_header(name, &sb) == 0) { ! 81: if (((ar_format == TAR) ! 82: ? buf_skip(ROUNDUP((OFFSET) sb.sb_size, BLOCKSIZE)) ! 83: : buf_skip((OFFSET) sb.sb_size)) < 0) { ! 84: warn(name, "File data is corrupt"); ! 85: } ! 86: } ! 87: /* we have now gotten to the end of the archive... */ ! 88: ! 89: /* reset the buffer now that we have read the entire archive */ ! 90: bufend = bufidx = bufstart; ! 91: lseek(archivefd, -((OFFSET) blocksize), 1); /* VLAD. duncing arround bugs */ ! 92: create_archive(); ! 93: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.