From 74c1a41d0765df9716732ac053df9ed7f24f38f0 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 27 May 2013 00:05:00 +0200 Subject: [PATCH] examples: print the usage message when a required option is missing While at it specify which option is missing when picoproj fails.. --- examples/am7xxx-play.c | 3 ++- examples/picoproj.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c index 38812a4..e958eee 100644 --- a/examples/am7xxx-play.c +++ b/examples/am7xxx-play.c @@ -777,7 +777,8 @@ int main(int argc, char *argv[]) } if (input_path == NULL) { - fprintf(stderr, "The -i option must always be passed\n"); + fprintf(stderr, "The -i option must always be passed\n\n"); + usage(argv[0]); ret = -EINVAL; goto out; } diff --git a/examples/picoproj.c b/examples/picoproj.c index 8341527..610e148 100644 --- a/examples/picoproj.c +++ b/examples/picoproj.c @@ -168,7 +168,8 @@ int main(int argc, char *argv[]) } if (filename[0] == '\0') { - fprintf(stderr, "An image file MUST be specified.\n"); + fprintf(stderr, "An image file MUST be specified with the -f option.\n\n"); + usage(argv[0]); exit_code = EXIT_FAILURE; goto out; } -- 2.1.4