projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added --help option
[pulseview.git]
/
main.cpp
diff --git
a/main.cpp
b/main.cpp
index a94f64c67b07b60b45cf2b96b5cb1fc264fbf8c6..b7ba5d8994e79c3d5fea053a2d59802ee378d16c 100644
(file)
--- a/
main.cpp
+++ b/
main.cpp
@@
-33,6
+33,18
@@
extern "C" {
#include "config.h"
#include "config.h"
+void usage()
+{
+ fprintf(stderr,
+ "Usage:\n"
+ " %s — %s\n"
+ "\n"
+ "Help Options:\n"
+ " -V, --version Show release version\n"
+ " -h, -?, --help Show help option\n"
+ "\n", PV_BIN_NAME, PV_DESCRIPTION);
+}
+
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
@@
-46,10
+58,12
@@
int main(int argc, char *argv[])
while (1) {
static const struct option long_options[] = {
{"version", no_argument, 0, 'V'},
while (1) {
static const struct option long_options[] = {
{"version", no_argument, 0, 'V'},
+ {"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
{0, 0, 0, 0}
};
- const char c = getopt_long(argc, argv, "V", long_options, NULL);
+ const char c = getopt_long(argc, argv,
+ "Vh?", long_options, NULL);
if (c == -1)
break;
if (c == -1)
break;
@@
-58,6
+72,11
@@
int main(int argc, char *argv[])
// Print version info
fprintf(stderr, "%s %s\n", PV_TITLE, PV_VERSION_STRING);
return 0;
// Print version info
fprintf(stderr, "%s %s\n", PV_TITLE, PV_VERSION_STRING);
return 0;
+
+ case 'h':
+ case '?':
+ usage();
+ return 0;
}
}
}
}