/*
 * 13-Mar-94 F. Munkert:
 * added 'include_conv' option (-D) to specify pathnames for restricting
 * conversion of file names to certain subdirectories.
 *
 * 9-Dec-93 R.-D. Marzusch, marzusch@odiehh.hanse.de:
 * added 'exclude' option (-x) to specify pathnames NOT to be included in 
 * CD image.
 */

#include <stdio.h>
#ifdef AMIGA
#include <stdlib.h>
#else
#include <malloc.h>
#endif
#include <string.h>

/* this allows for 1000 entries to be excluded ... */
#define MAXEXCL 1000
static char * excl[MAXEXCL];
static char * incl[MAXEXCL];

void exclude(char* fn)
{
  register int i;

  for (i=0; excl[i] && i<MAXEXCL; i++);
  if (i == MAXEXCL) {
    fprintf(stderr,"Can't exclude '%s' - too many entries in table\n",fn);
    return;
  }

 
  excl[i] = malloc(strlen(fn)+1);
  if (! excl[i]) {
    fprintf(stderr,"Can't allocate memory for excluded filename\n");
    return;
  }

  strcpy(excl[i],fn);
}

int is_excluded(char* fn)
{
  /* very dumb search method ... */
  register int i;

  for (i=0; excl[i] && i<MAXEXCL; i++) {
    if (strcmp(excl[i],fn) == 0) {
      return 1; /* found -> excluded filenmae */
    }
  }
  return 0; /* not found -> not excluded */
}


void include_conv(char* fn)
{
  register int i;

  for (i=0; incl[i] && i<MAXEXCL; i++);
  if (i == MAXEXCL) {
    fprintf(stderr,"Can't include '%s' for conversion "
            "- too many entries in table\n",fn);
    return;
  }

  incl[i] = malloc(strlen(fn)+1);
  if (! incl[i]) {
    fprintf(stderr,"Can't allocate memory for included filename\n");
    return;
  }

  strcpy(incl[i],fn);
}

int is_included_conv(char* fn)
{
  /* very dumb search method ... */
  register int i;

  for (i=0; incl[i] && i<MAXEXCL; i++) {
    if (strcmp(incl[i],fn) == 0) {
      return 1; /* found -> included filenmae */
    }
  }
  return 0; /* not found -> not included */
}

