#include "error.h"
#include "magic.h"
#include "var.h"
+#include "linked-list.h"
+
/* (headers) */
/* File handle. */
return handle;
}
+static void
+destroy_file_handle(void *fh_, void *aux UNUSED)
+{
+ struct file_handle *fh = fh_;
+ free (fh->name);
+ free (fh->filename);
+ fn_free_identity (fh->identity);
+ free (fh);
+}
+
static const char *
mode_name (const char *mode)
{
return h->open_cnt;
}
+
+static struct linked_list *handle_list;
+
+
/* Parses a file handle name, which may be a filename as a string or
a file handle name as an identifier. Returns the file handle or
NULL on failure. */
char *handle_name = xmalloc (strlen (filename) + 3);
sprintf (handle_name, "\"%s\"", filename);
handle = create_file_handle (handle_name, filename);
+ ll_push_front(handle_list, handle);
free (handle_name);
}
lex_get ();
+
return handle;
}
return handle->tab_width;
}
+
+void
+fh_init(void)
+{
+ handle_list = ll_create(destroy_file_handle,0);
+}
+
+void
+fh_done(void)
+{
+ assert(handle_list);
+
+ ll_destroy(handle_list);
+ handle_list = 0;
+}
+
+
/*
Local variables:
mode: c