Use basename(argv[0]) where appropriate to avoid hard coded tool name
This commit is contained in:
parent
3d52279dc3
commit
7ba9183d34
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
|
||||||
#include "human_readable_format.h"
|
#include "human_readable_format.h"
|
||||||
#include "metadata_dumper.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) {
|
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(argv[0]);
|
usage(basename(argv[0]));
|
||||||
return 0;
|
return 0;
|
||||||
case 'f':
|
case 'f':
|
||||||
format = optarg;
|
format = optarg;
|
||||||
@ -89,7 +90,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
usage(argv[0]);
|
usage(basename(argv[0]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
|
||||||
#include "metadata.h"
|
#include "metadata.h"
|
||||||
#include "metadata_checker.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) {
|
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(argv[0]);
|
usage(basename(argv[0]));
|
||||||
return 0;
|
return 0;
|
||||||
case 'V':
|
case 'V':
|
||||||
cerr << THIN_PROVISIONING_TOOLS_VERSION << endl;
|
cerr << THIN_PROVISIONING_TOOLS_VERSION << endl;
|
||||||
@ -70,7 +71,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
usage(argv[0]);
|
usage(basename(argv[0]));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
|
||||||
using namespace persistent_data;
|
using namespace persistent_data;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -78,7 +79,7 @@ int main(int argc, char **argv)
|
|||||||
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(argv[0]);
|
usage(basename(argv[0]));
|
||||||
return 0;
|
return 0;
|
||||||
case 'i':
|
case 'i':
|
||||||
input = optarg;
|
input = optarg;
|
||||||
@ -93,7 +94,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
usage(argv[0]);
|
usage(basename(argv[0]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user