aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
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;