[yocto] [ptest-runner 4/8] Add version(-v) since we change return code ABI

Jiwei Sun jiwei.sun at windriver.com
Thu Sep 28 19:09:36 PDT 2017


Signed-off-by: Jiwei Sun <jiwei.sun at windriver.com>
---
 main.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c
index 505829c..d524200 100644
--- a/main.c
+++ b/main.c
@@ -41,10 +41,16 @@
 static inline void
 print_usage(FILE *stream, char *progname)
 {
-	fprintf(stream, "Usage: %s [-d directory] [-l list] [-t timeout] [-x xml-filename]"
+	fprintf(stream, "Usage: %s [-v] [-d directory] [-l list] [-t timeout] [-x xml-filename]"
 			" [-h] [ptest1 ptest2 ...]\n", progname);
 }
 
+static inline void
+print_version(FILE *stream, char *progname)
+{
+	fprintf(stream, "version: 3.0.0\n");
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -66,7 +72,7 @@ main(int argc, char *argv[])
 	opts.ptests = NULL;
 	opts.xml_filename = NULL;
 
-	while ((opt = getopt(argc, argv, "d:lt:x:h")) != -1) {
+	while ((opt = getopt(argc, argv, "vd:lt:x:h")) != -1) {
 		switch (opt) {
 			case 'd':
 				free(opts.directory);
@@ -82,6 +88,9 @@ main(int argc, char *argv[])
 			case 'h':
 				print_usage(stdout, argv[0]);
 				exit(0);
+			case 'v':
+				print_version(stdout, argv[0]);
+				exit(0);
 			break;
 			case 'x':
 				free(opts.xml_filename);
-- 
1.8.3.1




More information about the yocto mailing list