home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 138.lha / Iff_Archiver / quickappend.c < prev    next >
C/C++ Source or Header  |  1986-11-20  |  1KB  |  51 lines

  1. /* iffar - IFF CAT archiver quick append functions
  2.  
  3.    By Karl Lehenbauer, version 1.2, release date 5/9/88.
  4.    This code is released to the public domain.
  5.    See the README file for more information.
  6.  
  7. */
  8.  
  9. #include <stdio.h>
  10. #include "assert.h"
  11.  
  12. extern int verbose;
  13.  
  14. /* append a list of files specified by an array of pointers to
  15.  * names, the number of entries in the array, and a file decscriptor
  16.  * to write them to
  17.  */
  18. quickappend_entries(archive_fd,entryname_pointers,entrycount)
  19. int archive_fd;
  20. char *entryname_pointers[];
  21. int entrycount;
  22. {
  23.     int files;
  24.     char *nameptr;
  25.  
  26.     /* for all names specified on the command line */
  27.     for (files = 0; files < entrycount; files++)
  28.     {
  29.         /* scdir will return nonnull values as long as the pattern
  30.          * matches files (it will return patternless names the first
  31.          * time and NULL the second
  32.          */
  33.         while (nameptr = scdir(entryname_pointers[files]))
  34.         {
  35.             /* append the file */
  36.             if (append_file_to_archive(nameptr,archive_fd))
  37.             {
  38.                 if (verbose)
  39.                     fprintf(stderr,"appended %s\n",nameptr);
  40.             }
  41.         }
  42.     }
  43.     if (!rewrite_archive_header(archive_fd))
  44.     {
  45.         fprintf(stderr,"rewrite of archive header failed... archive is presumed blown\n");
  46.     }
  47.     close(archive_fd);
  48. }
  49.  
  50. /* end of quickappend.c */
  51.