unsquashfs_info: add dump_state function and enable it

Add a dump_state function which dumps the queue state if
^\ is pressed twice within one second.

Currently only queue state is dumped, dumping of cache state will be
added later.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
index bc0bb6b..2568ead 100644
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -2416,7 +2416,7 @@
 
 
 #define VERSION() \
-	printf("unsquashfs version 4.2-git (2013/06/06)\n");\
+	printf("unsquashfs version 4.2-git (2013/06/08)\n");\
 	printf("copyright (C) 2013 Phillip Lougher "\
 		"<phillip@squashfs.org.uk>\n\n");\
     	printf("This program is free software; you can redistribute it and/or"\
diff --git a/squashfs-tools/unsquashfs_info.c b/squashfs-tools/unsquashfs_info.c
index 91307a1..ec5250c 100644
--- a/squashfs-tools/unsquashfs_info.c
+++ b/squashfs-tools/unsquashfs_info.c
@@ -38,6 +38,7 @@
 #include <string.h>
 
 #include "squashfs_fs.h"
+#include "unsquashfs.h"
 #include "error.h"
 
 static int silent = 0;
@@ -66,6 +67,22 @@
 
 void dump_state()
 {
+	disable_progress_bar();
+
+	printf("Queue status dump\n");
+	printf("=================\n");
+
+	printf("file buffer read queue (main thread -> reader thread)\n");
+	dump_queue(to_reader);
+
+	printf("file buffer decompress queue (reader thread -> inflate"
+							" thread(s))\n");
+	dump_queue(to_deflate);
+
+	printf("file buffer write queue (main thread -> writer thread)\n");
+	dump_queue(to_writer);
+
+	enable_progress_bar();
 }
 
 
@@ -107,9 +124,9 @@
 
 			/* set one second interval period, if ^\ received
 			   within then, dump queue and cache status */
-			waiting = 0; // 1;
+			waiting = 1;
 		} else
-			dump_state(); /* disabled */
+			dump_state();
 	}
 }