Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.5 KiB

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