mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Implement sector verification in tool.
This commit is contained in:
31
tool/main.c
31
tool/main.c
@@ -38,6 +38,7 @@ void usage()
|
||||
printf("\tread\tReads a sector and prints it out on screen.\n");
|
||||
printf("\tread_long\tReads a sector with all its prefixes and suffixes and prints it out on screen.\n");
|
||||
printf("\tverify\tVerifies the integrity of all blocks in a AaruFormat image.\n");
|
||||
printf("\tverify_sectors\tVerifies the integrity of all sectors in a AaruFormat image.\n");
|
||||
printf("\n");
|
||||
printf("For help on the verb invoke the tool with the verb and no arguments.\n");
|
||||
}
|
||||
@@ -99,6 +100,17 @@ void usage_verify()
|
||||
printf("\t<filename>\tPath to AaruFormat image to verify.\n");
|
||||
}
|
||||
|
||||
void usage_verify_sectors()
|
||||
{
|
||||
printf("\n");
|
||||
printf("Usage:\n");
|
||||
printf("aaruformattool verify_sectors <filename>\n");
|
||||
printf("Verifies the integrity of all sectors in a AaruFormat image.\n");
|
||||
printf("\n");
|
||||
printf("Arguments:\n");
|
||||
printf("\t<filename>\tPath to AaruFormat image to verify.\n");
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint64_t sector_no = 0;
|
||||
@@ -207,7 +219,24 @@ int main(int argc, char* argv[])
|
||||
return read(sector_no, argv[3]);
|
||||
}
|
||||
|
||||
if(strncmp(argv[1], "verify", strlen("verify")) == 0)
|
||||
if(strncmp(argv[1], "verify_sectors", strlen("verify_sectors")) == 0)
|
||||
{
|
||||
if(argc == 2)
|
||||
{
|
||||
usage_verify_sectors();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(argc > 3)
|
||||
{
|
||||
fprintf(stderr, "Invalid number of arguments\n");
|
||||
usage_verify_sectors();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return verify_sectors(argv[2]);
|
||||
}
|
||||
else if(strncmp(argv[1], "verify", strlen("verify")) == 0)
|
||||
{
|
||||
if(argc == 2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user