mirror of
https://github.com/vivier/EMILE.git
synced 2024-11-14 22:04:43 +00:00
option '-i' allows to dump start base and size of given file
This commit is contained in:
parent
a7b18f9ade
commit
5596502a8d
@ -25,14 +25,25 @@ int main(int argc, char **argv)
|
|||||||
iso9660_VOLUME *volume;
|
iso9660_VOLUME *volume;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
size_t size;
|
size_t size;
|
||||||
|
int get_info = 0;
|
||||||
int arg = 1;
|
int arg = 1;
|
||||||
char *devname;
|
char *devname;
|
||||||
|
|
||||||
if (argc > 2)
|
if ((argc > arg) && (strcmp(argv[arg], "-i") == 0)) {
|
||||||
|
arg++;
|
||||||
|
get_info = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc > arg)
|
||||||
devname = argv[arg++];
|
devname = argv[arg++];
|
||||||
else
|
else
|
||||||
devname = "/dev/cdrom";
|
devname = "/dev/cdrom";
|
||||||
|
|
||||||
|
if (argc > arg)
|
||||||
|
path = argv[arg++];
|
||||||
|
else
|
||||||
|
path = "/";
|
||||||
|
|
||||||
device.data = device_open(devname);
|
device.data = device_open(devname);
|
||||||
device.read_sector = (stream_read_sector_t)device_read_sector;
|
device.read_sector = (stream_read_sector_t)device_read_sector;
|
||||||
device.close = (stream_close_t)device_close;
|
device.close = (stream_close_t)device_close;
|
||||||
@ -41,11 +52,6 @@ int main(int argc, char **argv)
|
|||||||
if (volume == NULL)
|
if (volume == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (argc > arg)
|
|
||||||
path = argv[arg++];
|
|
||||||
else
|
|
||||||
path = "/";
|
|
||||||
|
|
||||||
file = iso9660_open(volume, path);
|
file = iso9660_open(volume, path);
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
@ -53,8 +59,12 @@ int main(int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (get_info) {
|
||||||
|
printf("%d %d\n", file->base, file->size);
|
||||||
|
} else {
|
||||||
while((size = iso9660_read(file, buffer, 512)) > 0)
|
while((size = iso9660_read(file, buffer, 512)) > 0)
|
||||||
write(STDOUT_FILENO, buffer, size);
|
write(STDOUT_FILENO, buffer, size);
|
||||||
|
}
|
||||||
iso9660_close(file);
|
iso9660_close(file);
|
||||||
|
|
||||||
iso9660_umount(volume);
|
iso9660_umount(volume);
|
||||||
|
Loading…
Reference in New Issue
Block a user