/*
 * collection.c:
 *
 * Copyright (c) 2000 James McKenzie <james@fishsoup.dhs.org>,
 * All rights reserved.
 *
 */

static char rcsid[] =
    "$Id: collection.c,v 1.3 2000/09/24 01:44:47 root Exp $";

/*
 * $Log: collection.c,v $
 * Revision 1.3  2000/09/24 01:44:47  root
 * #
 *
 * Revision 1.2  2000/09/19 05:06:22  root
 * #
 *
 * Revision 1.1  2000/09/19 03:53:27  root
 * #
 *
 */

#include "project.h"


EXTERNAL Files files_init(void)
{
  return CREATE_LIST(Collection);
}

EXTERNAL void files_add_collection(Files f, Collection c)
{

  Obj_Insert(f, c, ObjInsertTail);

}

EXTERNAL CFH files_open(Files f, Eweid e, int mode)
{
  Collection c = f->head;
  Eweid d = eweid_dev(e);

  while (c) {

    if (!EWEID_CMP(d, c->e)) {
      Obj_Delete(d);
      return c->open(c, e, mode);
    }


    c = c->next;
  }
  Obj_Delete(d);
  return NULL;

}


EXTERNAL void files_close(Files f)
{
  Obj_Delete(f);
}
