comparison ffstools/tiffs-rd/ls.c @ 235:e17bb8818318

tiffs ls: show read-only file flag
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 26 Jan 2014 18:17:03 +0000
parents 024042383a26
children 254de9560ef3
comparison
equal deleted inserted replaced
234:024042383a26 235:e17bb8818318
41 ls_callback(pathname, ino, depth) 41 ls_callback(pathname, ino, depth)
42 char *pathname; 42 char *pathname;
43 { 43 {
44 struct inode_info *inf = inode_info[ino]; 44 struct inode_info *inf = inode_info[ino];
45 u_long size; 45 u_long size;
46 char readonly;
46 47
48 if (inf->type & 0x10)
49 readonly = ' ';
50 else
51 readonly = 'r';
47 switch (inf->type) { 52 switch (inf->type) {
48 case 0xE1: 53 case 0xE1:
49 case 0xF1: 54 case 0xF1:
50 size = get_file_size(ino, 0); 55 size = get_file_size(ino, 0);
51 printf("f %7lu %s\n", size, pathname); 56 printf("f%c %7lu %s\n", readonly, size, pathname);
52 return; 57 return;
58 case 0xE2:
53 case 0xF2: 59 case 0xF2:
54 printf("d %s\n", pathname); 60 printf("d%c %s\n", readonly, pathname);
55 return; 61 return;
62 case 0xE3:
56 case 0xF3: 63 case 0xF3:
57 printf("l %s\n", pathname); 64 printf("l%c %s\n", readonly, pathname);
58 return; 65 return;
59 default: 66 default:
60 fprintf(stderr, 67 fprintf(stderr,
61 "BUG: bad inode byte %02X reached ls_callback()\n", 68 "BUG: bad inode byte %02X reached ls_callback()\n",
62 inf->type); 69 inf->type);