FreeCalypso > hg > freecalypso-sw
view ffstools/tiffs-rd/ls.c @ 233:ae9ff2d1e3da
tiffs IVA: basic ls integrated
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 26 Jan 2014 10:54:42 +0000 |
parents | |
children | 024042383a26 |
line wrap: on
line source
/* * This C module implements the ls command. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "types.h" #include "struct.h" #include "globals.h" #include "pathname.h" void ls_callback(pathname, ino, depth) char *pathname; { struct inode_info *inf = inode_info[ino]; char type; switch (inf->type) { case 0xE1: case 0xF1: type = 'f'; break; case 0xF2: type = 'd'; break; case 0xF3: type = 'l'; break; default: fprintf(stderr, "BUG: bad inode byte %02X reached ls_callback()\n", inf->type); exit(1); } printf("%c %s\n", type, pathname); } cmd_ls() { read_ffs_image(); find_inode_block(); alloc_inode_table(); find_root_inode(); traverse_visible_tree(ls_callback); exit(0); }