comparison mpffs/cat.c @ 40:7ceab8bfacb3

mpffs-cat and mpffs-xtr converted to use the new extra chunk handling
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 01 Jul 2013 07:04:01 +0000
parents 8256eec598dd
children
comparison
equal deleted inserted replaced
39:9bc7f0e03fa8 40:7ceab8bfacb3
44 } 44 }
45 len--; 45 len--;
46 } 46 }
47 } 47 }
48 48
49 void
50 extra_chunk_callback(obj, opaque)
51 struct objinfo *obj;
52 u_long opaque;
53 {
54 struct chunkinfo chi;
55
56 size_extra_chunk(obj, &chi);
57 cat_chunk(&chi);
58 }
59
49 cat_file(headidx) 60 cat_file(headidx)
50 { 61 {
51 int ent;
52 struct objinfo obj; 62 struct objinfo obj;
53 struct chunkinfo chi; 63 struct chunkinfo chi;
54 64
55 obj.entryno = headidx; 65 obj.entryno = headidx;
56 get_index_entry(&obj); 66 get_index_entry(&obj);
60 exit(1); 70 exit(1);
61 } 71 }
62 validate_chunk(&obj); 72 validate_chunk(&obj);
63 size_head_chunk(&obj, &chi); 73 size_head_chunk(&obj, &chi);
64 cat_chunk(&chi); 74 cat_chunk(&chi);
65 for (ent = obj.descend; ent != 0xFFFF; ent = obj.descend) { 75 iterate_extra_chunks(obj.descend, extra_chunk_callback, (u_long) 0);
66 obj.entryno = ent;
67 get_index_entry(&obj);
68 if (obj.type != 0xF4) {
69 fprintf(stderr,
70 "file continuation object at index %x: type %02X != expected F4\n",
71 ent, obj.type);
72 exit(1);
73 }
74 validate_chunk(&obj);
75 size_extra_chunk(&obj, &chi);
76 cat_chunk(&chi);
77 }
78 if (cat_v) 76 if (cat_v)
79 putchar('\n'); 77 putchar('\n');
80 } 78 }
81 79
82 usage() 80 usage()