From 8f19433b7ff8d5a6702b833dfdb5aeb65f231cd6 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Tue, 13 Nov 2007 03:16:44 +0000
Subject: Adhere to GNU standards (add necessary files, support --help and
 --version).

git-svn-id: http://svn.drobilla.net/lad/slv2@911 a436a847-0d15-0410-975c-d299462d15a1
---
 utils/lv2_inspect.c | 33 ++++++++++++++++++++++++++++++++-
 utils/lv2_list.c    | 38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 69 insertions(+), 2 deletions(-)

(limited to 'utils')

diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c
index dff51ec..26d0092 100644
--- a/utils/lv2_inspect.c
+++ b/utils/lv2_inspect.c
@@ -16,8 +16,10 @@
  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include CONFIG_H_PATH
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <slv2/slv2.h>
 
 
@@ -189,6 +191,24 @@ print_plugin(SLV2Plugin p)
 }
 
 
+void
+print_version()
+{
+	printf("lv2_inspect (slv2) " PACKAGE_VERSION "\n");
+	printf("Copyright (C) 2007 Dave Robillard <dave@drobilla.net>\n");
+	printf("License: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>\n");
+	printf("This is free software: you are free to change and redistribute it.\n");
+	printf("There is NO WARRANTY, to the extent permitted by law.\n");
+}
+
+
+void
+print_usage()
+{
+	printf("Usage: lv2_inspect PLUGIN_URI\n");
+	printf("Show information about an installed LV2 plugin.\n");
+}
+
 	
 int
 main(int argc, char** argv)
@@ -197,7 +217,18 @@ main(int argc, char** argv)
 	slv2_world_load_all(world);
 
 	if (argc != 2) {
-		fprintf(stderr, "Usage: %s PLUGIN_URI\n", argv[0]);
+		print_usage();
+		return -1;
+	}
+
+	if (!strcmp(argv[1], "--version")) {
+		print_version();
+		return 0;
+	} else if (!strcmp(argv[1], "--help")) {
+		print_usage();
+		return 0;
+	} else {
+		print_usage();
 		return -1;
 	}
 
diff --git a/utils/lv2_list.c b/utils/lv2_list.c
index 3e62c24..dbef82b 100644
--- a/utils/lv2_list.c
+++ b/utils/lv2_list.c
@@ -16,7 +16,9 @@
  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include CONFIG_H_PATH
 #include <stdio.h>
+#include <string.h>
 #include <slv2/slv2.h>
 
 
@@ -30,9 +32,43 @@ list_plugins(SLV2Plugins list)
 }
 
 
+void
+print_version()
+{
+	printf("lv2_list (slv2) " PACKAGE_VERSION "\n");
+	printf("Copyright (C) 2007 Dave Robillard <dave@drobilla.net>\n");
+	printf("License: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>\n");
+	printf("This is free software: you are free to change and redistribute it.\n");
+	printf("There is NO WARRANTY, to the extent permitted by law.\n");
+}
+
+
+void
+print_usage()
+{
+	printf("Usage: lv2_list\n");
+	printf("List all installed LV2 plugins.\n");
+	printf("The environment variable LV2_PATH can be used to control where\n");
+	printf("this (and all other slv2 based LV2 hosts) will search for plugins.\n");
+}
+
+
 int
-main()//int argc, char** argv)
+main(int argc, char** argv)
 {
+	if (argc > 1) {
+		if (argc == 2 && !strcmp(argv[1], "--version")) {
+			print_version();
+			return 0;
+		} else if (argc == 2 && !strcmp(argv[1], "--help")) {
+			print_usage();
+			return 0;
+		} else {
+			print_usage();
+			return -1;
+		}
+	}
+
 	SLV2World world = slv2_world_new();
 	slv2_world_load_all(world);
 
-- 
cgit v1.2.1