2005-11-12 19:12:13 +00:00
|
|
|
/*
|
|
|
|
*
|
2006-09-15 14:55:39 +00:00
|
|
|
* (c) 2005 Laurent Vivier <Laurent@lvivier.info>
|
2005-11-12 19:12:13 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "libiso9660.h"
|
|
|
|
|
2005-11-21 22:07:17 +00:00
|
|
|
iso9660_FILE* iso9660_open(iso9660_VOLUME *volume, char* pathname)
|
2005-11-12 19:12:13 +00:00
|
|
|
{
|
|
|
|
struct iso_directory_record *root;
|
|
|
|
struct iso_directory_record *idr;
|
|
|
|
iso9660_FILE *file;
|
|
|
|
|
2005-11-21 22:07:17 +00:00
|
|
|
root = iso9660_get_root_node(volume);
|
2005-11-12 19:12:13 +00:00
|
|
|
if (root == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2005-11-21 22:07:17 +00:00
|
|
|
idr = iso9660_get_node(volume, root, pathname);
|
2005-11-12 19:12:13 +00:00
|
|
|
if (idr == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
file = (iso9660_FILE*)malloc(sizeof(iso9660_FILE));
|
|
|
|
if (file == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2007-02-24 11:42:45 +00:00
|
|
|
file->base = isonum_733((char *)idr->extent);
|
|
|
|
file->size = isonum_733((char *)idr->size);
|
2005-11-14 19:30:39 +00:00
|
|
|
file->offset = 0;
|
|
|
|
file->current = -1;
|
2005-11-21 22:07:17 +00:00
|
|
|
file->volume = volume;
|
2005-11-12 19:12:13 +00:00
|
|
|
|
|
|
|
free(idr);
|
|
|
|
|
|
|
|
return file;
|
|
|
|
}
|