changeset 27:62a0cda8b099

Add version output
author Chris Cannam
date Sun, 08 Jan 2017 16:09:47 +0000
parents 2cc992ed9b42
children 7a20698b4c29
files src/helper.cpp version.h
diffstat 2 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/helper.cpp	Tue Jan 03 16:14:48 2017 +0000
+++ b/src/helper.cpp	Sun Jan 08 16:09:47 2017 +0000
@@ -56,6 +56,8 @@
     dealings in this Software without prior written authorization.
 */
 
+#include "../version.h"
+
 #ifdef _WIN32
 #include <windows.h>
 #include <process.h>
@@ -193,8 +195,23 @@
     bool allGood = true;
     string soname;
 
-    if (argc != 2) {
-        cerr << "\nUsage:\n    " << argv[0] << " descriptorname\n"
+    bool showUsage = false;
+    
+    if (argc > 1) {
+        string opt = argv[1];
+        if (opt == "-?" || opt == "-h" || opt == "--help") {
+            showUsage = true;
+        } else if (opt == "-v" || opt == "--version") {
+            cout << CHECKER_VERSION << endl;
+            return 0;
+        }
+    } 
+    
+    if (argc != 2 || showUsage) {
+        cerr << endl;
+        cerr << "plugin-checker-helper: Test shared library objects for plugins to be" << endl;
+        cerr << "loaded via descriptor functions." << endl;
+        cerr << "\n    Usage: plugin-checker-helper <descriptorname>\n"
             "\nwhere descriptorname is the name of a plugin descriptor symbol to be sought\n"
             "in each library (e.g. vampGetPluginDescriptor for Vamp plugins). The list of\n"
             "candidate plugin library filenames is read from stdin.\n" << endl;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/version.h	Sun Jan 08 16:09:47 2017 +0000
@@ -0,0 +1,1 @@
+#define CHECKER_VERSION "1.0"