/* $Id: isofile.c,v 1.2 2008/03/24 15:30:55 karl Exp $ Copyright (C) 2004, 2005, 2006, 2008 Rocky Bernstein This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* Simple program to show using libiso9660 to extract a file from an ISO-9660 image. If a single argument is given, it is used as the ISO 9660 image to use in the extraction. Otherwise a compiled in default ISO 9660 image name (that comes with the libcdio distribution) will be used. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif int main(int argc, const char *argv[]) { iso9660_stat_t *p_statbuf; FILE *p_outfd; int i; char const *psz_image; iso9660_t *p_iso; CdioList_t *children; CdioListNode_t *node; if (argc < 2) { printf("Usage: %s [ISO]\n", argv[0]); return 1; } psz_image = argv[1]; p_iso = iso9660_open (psz_image); if (NULL == p_iso) { fprintf(stderr, "Sorry, couldn't open ISO 9660 image %s\n", psz_image); return 1; } children = iso9660_ifs_readdir (p_iso, "/."); if (NULL == children) { fprintf(stderr, "Could not list files under root directory\n"); iso9660_close(p_iso); return 2; } for (node = _cdio_list_begin(children); node; node = _cdio_list_node_next(node)) { iso9660_stat_t *child_stat = _cdio_list_node_data (node); printf ("%s\n", child_stat->filename); } iso9660_close(p_iso); return 0; }