home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 10 / Fresh_Fish_10_2352.bin / useful / disk / cdrom / mkisofs / exclude.c < prev    next >
C/C++ Source or Header  |  1994-05-29  |  2KB  |  91 lines

  1. /*
  2.  * 13-Mar-94 F. Munkert:
  3.  * added 'include_conv' option (-D) to specify pathnames for restricting
  4.  * conversion of file names to certain subdirectories.
  5.  *
  6.  * 9-Dec-93 R.-D. Marzusch, marzusch@odiehh.hanse.de:
  7.  * added 'exclude' option (-x) to specify pathnames NOT to be included in 
  8.  * CD image.
  9.  */
  10.  
  11. #include <stdio.h>
  12. #ifdef AMIGA
  13. #include <stdlib.h>
  14. #else
  15. #include <malloc.h>
  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. static char * incl[MAXEXCL];
  23.  
  24. void exclude(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] = 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(char* fn)
  45. {
  46.   /* very dumb search method ... */
  47.   register int i;
  48.  
  49.   for (i=0; excl[i] && i<MAXEXCL; i++) {
  50.     if (strcmp(excl[i],fn) == 0) {
  51.       return 1; /* found -> excluded filenmae */
  52.     }
  53.   }
  54.   return 0; /* not found -> not excluded */
  55. }
  56.  
  57.  
  58. void include_conv(char* fn)
  59. {
  60.   register int i;
  61.  
  62.   for (i=0; incl[i] && i<MAXEXCL; i++);
  63.   if (i == MAXEXCL) {
  64.     fprintf(stderr,"Can't include '%s' for conversion "
  65.             "- too many entries in table\n",fn);
  66.     return;
  67.   }
  68.  
  69.   incl[i] = malloc(strlen(fn)+1);
  70.   if (! incl[i]) {
  71.     fprintf(stderr,"Can't allocate memory for included filename\n");
  72.     return;
  73.   }
  74.  
  75.   strcpy(incl[i],fn);
  76. }
  77.  
  78. int is_included_conv(char* fn)
  79. {
  80.   /* very dumb search method ... */
  81.   register int i;
  82.  
  83.   for (i=0; incl[i] && i<MAXEXCL; i++) {
  84.     if (strcmp(incl[i],fn) == 0) {
  85.       return 1; /* found -> included filenmae */
  86.     }
  87.   }
  88.   return 0; /* not found -> not included */
  89. }
  90.  
  91.