home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / pax / 1 / append.c next >
Encoding:
C/C++ Source or Header  |  1989-01-07  |  2.2 KB  |  87 lines

  1. /* $Source: /u/mark/src/pax/RCS/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 (mark@jhereg.mn.org)
  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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  31.  *
  32.  * $Log:    append.c,v $
  33.  * Revision 1.1  88/12/23  18:02:00  mark
  34.  * Initial revision
  35.  * 
  36.  */
  37.  
  38. #ifndef lint
  39. static char *ident = "$Id: append.c,v 1.1 88/12/23 18:02:00 mark Rel $";
  40. static char *copyright = "Copyright (c) 1989 Mark H. Colburn.\nAll rights reserved.\n";
  41. #endif /* ! lint */
  42.  
  43.  
  44. /* Headers */
  45.  
  46. #include "pax.h"
  47.  
  48.  
  49. /* append_archive - main loop for appending to a tar archive
  50.  *
  51.  * DESCRIPTION
  52.  *
  53.  *    Append_archive reads an archive until the end of the archive is
  54.  *    reached once the archive is reached, the buffers are reset and the
  55.  *    create_archive function is called to handle the actual writing of
  56.  *    the appended archive data.  This is quite similar to the
  57.  *    read_archive function, however, it does not do all the processing.
  58.  */
  59.  
  60. #ifdef __STDC__
  61.  
  62. void append_archive(void)
  63.  
  64. #else
  65.  
  66. void append_archive()
  67.  
  68. #endif
  69. {
  70.     Stat            sb;
  71.     char            name[PATH_MAX + 1];
  72.  
  73.     name[0] = '\0';
  74.     while (get_header(name, &sb) == 0) {
  75.     if (((ar_format == TAR)
  76.          ? buf_skip(ROUNDUP((OFFSET) sb.sb_size, BLOCKSIZE))
  77.          : buf_skip((OFFSET) sb.sb_size)) < 0) {
  78.         warn(name, "File data is corrupt");
  79.     }
  80.     }
  81.     /* we have now gotten to the end of the archive... */
  82.  
  83.     /* reset the buffer now that we have read the entire archive */
  84.     bufend = bufidx = bufstart;
  85.     create_archive();
  86. }
  87.