FreeCalypso > hg > freecalypso-sw
changeset 236:254de9560ef3
tiffs ls -v implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 26 Jan 2014 19:03:33 +0000 |
parents | e17bb8818318 |
children | 317936902be4 |
files | ffstools/tiffs-rd/globals.c ffstools/tiffs-rd/globals.h ffstools/tiffs-rd/ls.c |
diffstat | 3 files changed, 42 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ffstools/tiffs-rd/globals.c Sun Jan 26 18:17:03 2014 +0000 +++ b/ffstools/tiffs-rd/globals.c Sun Jan 26 19:03:33 2014 +0000 @@ -12,7 +12,7 @@ u32 total_ffs_size; int index_blk_num = -1, root_inode; int inode_limit; -int verbose; +int verbose, verbose2; u8 *image, *inode_block; struct inode_info **inode_info;
--- a/ffstools/tiffs-rd/globals.h Sun Jan 26 18:17:03 2014 +0000 +++ b/ffstools/tiffs-rd/globals.h Sun Jan 26 19:03:33 2014 +0000 @@ -8,7 +8,7 @@ extern u32 total_ffs_size; extern int index_blk_num, root_inode; extern int inode_limit; -extern int verbose; +extern int verbose, verbose2; extern u8 *image, *inode_block; extern struct inode_info **inode_info;
--- a/ffstools/tiffs-rd/ls.c Sun Jan 26 18:17:03 2014 +0000 +++ b/ffstools/tiffs-rd/ls.c Sun Jan 26 19:03:33 2014 +0000 @@ -37,6 +37,27 @@ return(accum); } +static void +segment_ls_callback(inf, opaque) + struct inode_info *inf; + u_long opaque; +{ + struct chunkinfo chi; + + size_extra_chunk(inf, &chi); + printf("seg #%04x length=%lu\n", inf->ino, (u_long) chi.len); +} + +ls_seg_file(seghead_ino, deleted) +{ + struct inode_info *inf = inode_info[seghead_ino]; + struct chunkinfo chi; + + size_head_chunk(inf, &chi); + printf("%lu bytes in seghead\n", (u_long) chi.len); + iterate_seg_file(seghead_ino, segment_ls_callback, 0L, deleted); +} + void ls_callback(pathname, ino, depth) char *pathname; @@ -54,6 +75,8 @@ case 0xF1: size = get_file_size(ino, 0); printf("f%c %7lu %s\n", readonly, size, pathname); + if (verbose2) + ls_seg_file(ino, 0); return; case 0xE2: case 0xF2: @@ -71,7 +94,7 @@ } } -cmd_ls() +ls_visible_tree() { read_ffs_image(); find_inode_block(); @@ -80,3 +103,19 @@ traverse_visible_tree(ls_callback); exit(0); } + +cmd_ls(argc, argv) + char **argv; +{ + char **ap; + + ap = argv + 1; + if (*ap && !strcmp(*ap, "-v")) { + verbose2++; + ap++; + } + if (!*ap) + return ls_visible_tree(); + fprintf(stderr, "ls of individual files not yet implemented\n"); + exit(1); +}