home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 497a.lha / ComSMUS_v2.2 / iffar.src / quickappend.c < prev    next >
C/C++ Source or Header  |  1991-04-07  |  1KB  |  52 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.     extern char *scdir();
  26.  
  27.     /* for all names specified on the command line */
  28.     for (files = 0; files < entrycount; files++)
  29.     {
  30.         /* scdir will return nonnull values as long as the pattern
  31.          * matches files (it will return patternless names the first
  32.          * time and NULL the second
  33.          */
  34.         while (nameptr = scdir(entryname_pointers[files]))
  35.         {
  36.             /* append the file */
  37.             if (append_file_to_archive(nameptr,archive_fd))
  38.             {
  39.                 if (verbose)
  40.                     fprintf(stderr,"appended %s\n",nameptr);
  41.             }
  42.         }
  43.     }
  44.     if (!rewrite_archive_header(archive_fd))
  45.     {
  46.         fprintf(stderr,"rewrite of archive header failed... archive is presumed blown\n");
  47.     }
  48.     close(archive_fd);
  49. }
  50.  
  51. /* end of quickappend.c */
  52.