From 7ba9183d347364b588112c33836e1ed870cd80c4 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Thu, 15 Dec 2011 15:17:49 +0100 Subject: [PATCH] Use basename(argv[0]) where appropriate to avoid hard coded tool name --- thin_dump.cc | 5 +++-- thin_repair.cc | 5 +++-- thin_restore.cc | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/thin_dump.cc b/thin_dump.cc index f70a95f..c01ce62 100644 --- a/thin_dump.cc +++ b/thin_dump.cc @@ -18,6 +18,7 @@ #include #include +#include #include "human_readable_format.h" #include "metadata_dumper.h" @@ -74,7 +75,7 @@ int main(int argc, char **argv) while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) { switch(c) { case 'h': - usage(argv[0]); + usage(basename(argv[0])); return 0; case 'f': format = optarg; @@ -89,7 +90,7 @@ int main(int argc, char **argv) } if (argc == 1) { - usage(argv[0]); + usage(basename(argv[0])); return 1; } diff --git a/thin_repair.cc b/thin_repair.cc index 8e47efb..30b9c7e 100644 --- a/thin_repair.cc +++ b/thin_repair.cc @@ -18,6 +18,7 @@ #include #include +#include #include "metadata.h" #include "metadata_checker.h" @@ -61,7 +62,7 @@ int main(int argc, char **argv) while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) { switch(c) { case 'h': - usage(argv[0]); + usage(basename(argv[0])); return 0; case 'V': cerr << THIN_PROVISIONING_TOOLS_VERSION << endl; @@ -70,7 +71,7 @@ int main(int argc, char **argv) } if (argc != 2) { - usage(argv[0]); + usage(basename(argv[0])); exit(1); } diff --git a/thin_restore.cc b/thin_restore.cc index 43aa3cc..041e4e7 100644 --- a/thin_restore.cc +++ b/thin_restore.cc @@ -26,6 +26,7 @@ #include #include #include +#include using namespace persistent_data; using namespace std; @@ -78,7 +79,7 @@ int main(int argc, char **argv) while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) { switch(c) { case 'h': - usage(argv[0]); + usage(basename(argv[0])); return 0; case 'i': input = optarg; @@ -93,7 +94,7 @@ int main(int argc, char **argv) } if (argc == 1) { - usage(argv[0]); + usage(basename(argv[0])); return 1; }