shithub: mcfs

Download patch

ref: b3593d1790eab158497d7f1a3cbfcebcbac61200
parent: 67da1c1aa4fb615fbc23d499c1b58956d329bb6d
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Feb 5 06:06:48 EST 2021

mkvdump: print element size if debugging enabled (-d)

--- a/extra/mkvdump.c
+++ b/extra/mkvdump.c
@@ -7,7 +7,7 @@
 static void
 usage(void)
 {
-	fprint(2, "usage: %s [file.mkv]\n", argv0);
+	fprint(2, "usage: %s [-d] [-h hxsz] [file.mkv]\n", argv0);
 	exits("usage");
 }
 
@@ -14,7 +14,7 @@
 void
 main(int argc, char **argv)
 {
-	int n, sti, i, hxsz, lacing, fd;
+	int n, sti, i, hxsz, lacing, fd, debug;
 	vlong sz, off, x;
 	uchar *b, t[3];
 	Biobuf in, out;
@@ -22,8 +22,12 @@
 	double d;
 	Tm tm;
 
+	debug = 0;
 	hxsz = 32;
 	ARGBEGIN{
+	case 'd':
+		debug++;
+		break;
 	case 'h':
 		if((hxsz = atoi(EARGF(usage()))) > 0)
 			break;
@@ -62,6 +66,8 @@
 			for(i = 0; i < sti; i++)
 				Bputc(&out, '\t');
 			Bprint(&out, "%s ", s.name);
+			if(debug)
+				Bprint(&out, " (%zd bytes) ", sz);
 			if(s.type == Emaster && sti < nelem(stack))
 				stack[sti++] = off+n+sz;
 		}else{