diff 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
line wrap: on
line diff
--- a/mpffs/cat.c	Mon Jul 01 06:49:50 2013 +0000
+++ b/mpffs/cat.c	Mon Jul 01 07:04:01 2013 +0000
@@ -46,9 +46,19 @@
 	}
 }
 
+void
+extra_chunk_callback(obj, opaque)
+	struct objinfo *obj;
+	u_long opaque;
+{
+	struct chunkinfo chi;
+
+	size_extra_chunk(obj, &chi);
+	cat_chunk(&chi);
+}
+
 cat_file(headidx)
 {
-	int ent;
 	struct objinfo obj;
 	struct chunkinfo chi;
 
@@ -62,19 +72,7 @@
 	validate_chunk(&obj);
 	size_head_chunk(&obj, &chi);
 	cat_chunk(&chi);
-	for (ent = obj.descend; ent != 0xFFFF; ent = obj.descend) {
-		obj.entryno = ent;
-		get_index_entry(&obj);
-		if (obj.type != 0xF4) {
-			fprintf(stderr,
-	"file continuation object at index %x: type %02X != expected F4\n",
-				ent, obj.type);
-			exit(1);
-		}
-		validate_chunk(&obj);
-		size_extra_chunk(&obj, &chi);
-		cat_chunk(&chi);
-	}
+	iterate_extra_chunks(obj.descend, extra_chunk_callback, (u_long) 0);
 	if (cat_v)
 		putchar('\n');
 }