From 6804eafb1992b8635a5b3ef75fd094a808ff7000 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 1 Feb 2013 12:54:29 +0800 Subject: [PATCH] DiskTool - Actual help message :) --- Tools/DiskTool/main.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Tools/DiskTool/main.c b/Tools/DiskTool/main.c index 81a087c1..f8781a49 100644 --- a/Tools/DiskTool/main.c +++ b/Tools/DiskTool/main.c @@ -8,6 +8,31 @@ #include // === CODE === +void PrintUsage(void) +{ + fprintf(stderr, + "Usage:\n" + " disktool \n" + "\n" + "Commands:\n" + " lvm \n" + " - Register an image with LVM\n" + " e.g.\n" + " `lvm ../AcessHDD.img HDD`\n" + " mount \n" + " - Bind an image to a name.\n" + " e.g.\n" + " `mount ../AcessFDD.img FDD`\n" + " `mount :HDD/0 hda1`\n" + " ls \n" + " - List a directory\n" + " e.g.\n" + " `ls ../`\n" + " `ls FDD:/`\n" + "\n" + ); +} + int main(int argc, char *argv[]) { // Parse arguments @@ -17,6 +42,7 @@ int main(int argc, char *argv[]) // Mount an image if( argc - i < 3 ) { fprintf(stderr, "mount takes 2 arguments (image and mountpoint)\n"); + PrintUsage(); exit(-1); } @@ -33,6 +59,7 @@ int main(int argc, char *argv[]) if( argc - i < 3 ) { fprintf(stderr, "lvm takes 2 arguments (iamge and ident)\n"); + PrintUsage(); exit(-1); } @@ -48,6 +75,7 @@ int main(int argc, char *argv[]) if( strcmp("ls", argv[i]) == 0 ) { if( argc - i < 2 ) { fprintf(stderr, "ls takes 1 argument (path)\n"); + PrintUsage(); break; } @@ -60,6 +88,7 @@ int main(int argc, char *argv[]) if( argc - i < 3 ) { fprintf(stderr, "cp takes 2 arguments (source and destination)\n"); + PrintUsage(); break; } @@ -73,6 +102,7 @@ int main(int argc, char *argv[]) if( argc - 1 < 2 ) { fprintf(stderr, "cat takes 1 argument (path)\n"); + PrintUsage(); break; } @@ -83,6 +113,7 @@ int main(int argc, char *argv[]) } fprintf(stderr, "Unknown command '%s'\n", argv[i]); + PrintUsage(); } DiskTool_Cleanup(); -- 2.20.1