home *** CD-ROM | disk | FTP | other *** search
/ Dream 49 / Amiga_Dream_49.iso / beos / utils / mkisofs-1.000 / mkisofs-1.11-beos / exclude.c < prev    next >
C/C++ Source or Header  |  1997-04-09  |  1KB  |  57 lines

  1. /*
  2.  * 9-Dec-93 R.-D. Marzusch, marzusch@odiehh.hanse.de:
  3.  * added 'exclude' option (-x) to specify pathnames NOT to be included in 
  4.  * CD image.
  5.  */
  6.  
  7. static char rcsid[] ="$Id: exclude.c,v 1.2 1997/02/23 16:12:34 eric Rel $";
  8.  
  9. #include <stdio.h>
  10. #ifndef VMS
  11. #ifdef HAVE_MALLOC_H
  12. #include <malloc.h>
  13. #else
  14. #include <stdlib.h>
  15. #endif
  16. #endif
  17. #include <string.h>
  18.  
  19. /* this allows for 1000 entries to be excluded ... */
  20. #define MAXEXCL 1000
  21. static char * excl[MAXEXCL];
  22.  
  23. void exclude(fn)
  24. char * fn;
  25. {
  26.   register int i;
  27.  
  28.   for (i=0; excl[i] && i<MAXEXCL; i++);
  29.   if (i == MAXEXCL) {
  30.     fprintf(stderr,"Can't exclude '%s' - too many entries in table\n",fn);
  31.     return;
  32.   }
  33.  
  34.  
  35.   excl[i] = (char *) malloc(strlen(fn)+1);
  36.   if (! excl[i]) {
  37.     fprintf(stderr,"Can't allocate memory for excluded filename\n");
  38.     return;
  39.   }
  40.  
  41.   strcpy(excl[i],fn);
  42. }
  43.  
  44. int is_excluded(fn)
  45. char * fn;
  46. {
  47.   /* very dumb search method ... */
  48.   register int i;
  49.  
  50.   for (i=0; excl[i] && i<MAXEXCL; i++) {
  51.     if (strcmp(excl[i],fn) == 0) {
  52.       return 1; /* found -> excluded filenmae */
  53.     }
  54.   }
  55.   return 0; /* not found -> not excluded */
  56. }
  57.