devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
Subject: [PATCH] dtc: Show the usage text if no parameter is passed
Date: Wed, 18 Oct 2017 21:28:27 -0200	[thread overview]
Message-ID: <1508369307-22307-1-git-send-email-festevam@gmail.com> (raw)

From: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>

When dtc is called without any argument the application hangs forever.

Instead of hanging, print the usage and exit.

Signed-off-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
---
 dtc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dtc.c b/dtc.c
index 5ed873c..6308a63 100644
--- a/dtc.c
+++ b/dtc.c
@@ -269,6 +269,8 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	if (argc == 1)
+		usage(NULL);
 	if (argc > (optind+1))
 		usage("missing files");
 	else if (argc < (optind+1))
-- 
2.7.4

             reply	other threads:[~2017-10-18 23:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18 23:28 Fabio Estevam [this message]
     [not found] ` <1508369307-22307-1-git-send-email-festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-19  0:02   ` [PATCH] dtc: Show the usage text if no parameter is passed Rob Herring
     [not found]     ` <CAL_JsqLi5Jte+7_d1kq-Uka=7nV9foKudQ9w31noA++bvUJWjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-19  0:38       ` Fabio Estevam
     [not found]         ` <CAOMZO5A3ettpwGVATUL3PF6Hj-3087E93QVLZ0tNgD-BG53MYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-19  2:02           ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508369307-22307-1-git-send-email-festevam@gmail.com \
    --to=festevam-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=fabio.estevam-3arQi8VN3Tc@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).