aboutsummaryrefslogtreecommitdiff
path: root/src/tools/myriad.cpp
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2024-08-05 10:40:14 -0700
committerMike Buland <mike@xagasoft.com>2024-08-05 10:40:14 -0700
commite343acc2548fba7670977029da8373a0e58fa25a (patch)
tree3584cbee31d23b4ea4dd8d54545ee092ae5076f3 /src/tools/myriad.cpp
parentd344a682170e42ef3ca4e37b397428f9ba5fdb11 (diff)
downloadlibbu++-e343acc2548fba7670977029da8373a0e58fa25a.tar.gz
libbu++-e343acc2548fba7670977029da8373a0e58fa25a.tar.bz2
libbu++-e343acc2548fba7670977029da8373a0e58fa25a.tar.xz
libbu++-e343acc2548fba7670977029da8373a0e58fa25a.zip
Added loads and loads of debugging output to myriad.
There's an issue somewhere sometimes and streams are being truncated. My guess is a multi-threaded issue.
Diffstat (limited to '')
-rw-r--r--src/tools/myriad.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/myriad.cpp b/src/tools/myriad.cpp
index 0130b49..ccf3d3b 100644
--- a/src/tools/myriad.cpp
+++ b/src/tools/myriad.cpp
@@ -23,6 +23,7 @@ enum Mode
23 modeStreamDump, 23 modeStreamDump,
24 modeStreamPut, 24 modeStreamPut,
25 modeStreamGet, 25 modeStreamGet,
26 modeBlockMap,
26 27
27 modeNone 28 modeNone
28}; 29};
@@ -49,6 +50,8 @@ public:
49 "Get a file out of a Myriad stream (use --dst)."); 50 "Get a file out of a Myriad stream (use --dst).");
50 addOption( eMode, "put", 51 addOption( eMode, "put",
51 "Put a file into a Myriad stream (usr --src)."); 52 "Put a file into a Myriad stream (usr --src).");
53 addOption( eMode, 'm', "block-map",
54 "Visualize block usage.");
52 addHelpOption(); 55 addHelpOption();
53 56
54 addHelpBanner("\nGeneral options:"); 57 addHelpBanner("\nGeneral options:");
@@ -67,6 +70,7 @@ public:
67 setOverride( "dump", modeStreamDump ); 70 setOverride( "dump", modeStreamDump );
68 setOverride( "put", modeStreamPut ); 71 setOverride( "put", modeStreamPut );
69 setOverride( "get", modeStreamGet ); 72 setOverride( "get", modeStreamGet );
73 setOverride( "block-map", modeBlockMap );
70 74
71 parse( argc, argv ); 75 parse( argc, argv );
72 } 76 }
@@ -242,6 +246,29 @@ int main( int argc, char *argv[] )
242 } 246 }
243 break; 247 break;
244 248
249 case modeBlockMap:
250 if( !opts.sFile.isSet() )
251 {
252 sio << "Please specify a file manipulate." << sio.nl;
253 return 0;
254 }
255 {
256 File fIn( opts.sFile, File::Write|File::Read );
257 Myriad m( fIn );
258 Bu::BitString bs = m.getBlocksUsed();
259 for( int j = 0; j < bs.getSize(); j++ )
260 {
261 if( j>0 && (j%50) == 0 )
262 Bu::println("");
263 if( bs.getBit( j ) )
264 Bu::print("#");
265 else
266 Bu::print("-");
267 }
268 Bu::println("\n");
269 }
270 break;
271
245 case modeNone: 272 case modeNone:
246 sio << "Please select a mode, for more info, try --help." 273 sio << "Please select a mode, for more info, try --help."
247 << sio.nl << sio.nl; 274 << sio.nl << sio.nl;