* [PATCH] dtc: Show the usage text if no parameter is passed @ 2017-10-18 23:28 Fabio Estevam [not found] ` <1508369307-22307-1-git-send-email-festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Fabio Estevam @ 2017-10-18 23:28 UTC (permalink / raw) To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+ Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Fabio Estevam 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <1508369307-22307-1-git-send-email-festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] dtc: Show the usage text if no parameter is passed [not found] ` <1508369307-22307-1-git-send-email-festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2017-10-19 0:02 ` Rob Herring [not found] ` <CAL_JsqLi5Jte+7_d1kq-Uka=7nV9foKudQ9w31noA++bvUJWjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Rob Herring @ 2017-10-19 0:02 UTC (permalink / raw) To: Fabio Estevam; +Cc: David Gibson, Devicetree Compiler, Fabio Estevam On Wed, Oct 18, 2017 at 6:28 PM, Fabio Estevam <festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > 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. I think it is valid to do: dtc < in > out This doesn't hang: $ dtc < /dev/null Error: <stdin>:0.0 syntax error FATAL ERROR: Unable to parse input tree The help though isn't clear that input file is optional. Rob ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAL_JsqLi5Jte+7_d1kq-Uka=7nV9foKudQ9w31noA++bvUJWjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] dtc: Show the usage text if no parameter is passed [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> 0 siblings, 1 reply; 4+ messages in thread From: Fabio Estevam @ 2017-10-19 0:38 UTC (permalink / raw) To: Rob Herring; +Cc: David Gibson, Devicetree Compiler, Fabio Estevam On Wed, Oct 18, 2017 at 10:02 PM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: > On Wed, Oct 18, 2017 at 6:28 PM, Fabio Estevam <festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> 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. > > I think it is valid to do: > dtc < in > out > > This doesn't hang: > $ dtc < /dev/null > Error: <stdin>:0.0 syntax error > FATAL ERROR: Unable to parse input tree These examples do not have argc == 1. If 'dtc' is called with no arguments than the application never exits. ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAOMZO5A3ettpwGVATUL3PF6Hj-3087E93QVLZ0tNgD-BG53MYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] dtc: Show the usage text if no parameter is passed [not found] ` <CAOMZO5A3ettpwGVATUL3PF6Hj-3087E93QVLZ0tNgD-BG53MYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-10-19 2:02 ` David Gibson 0 siblings, 0 replies; 4+ messages in thread From: David Gibson @ 2017-10-19 2:02 UTC (permalink / raw) To: Fabio Estevam; +Cc: Rob Herring, Devicetree Compiler, Fabio Estevam [-- Attachment #1: Type: text/plain, Size: 1372 bytes --] On Wed, Oct 18, 2017 at 10:38:41PM -0200, Fabio Estevam wrote: > On Wed, Oct 18, 2017 at 10:02 PM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: > > On Wed, Oct 18, 2017 at 6:28 PM, Fabio Estevam <festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> 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. > > > > I think it is valid to do: > > dtc < in > out > > > > This doesn't hang: > > $ dtc < /dev/null > > Error: <stdin>:0.0 syntax error > > FATAL ERROR: Unable to parse input tree > > These examples do not have argc == 1. Yes they do. Everything after the < is processed by the shell and doesn't appear to dtc as a parameter. > If 'dtc' is called with no arguments than the application never > exits. If dtc is called with no arguments it attempts to read a dts from standard input and send a dtb to standard output. It exits when input finishes. So, if you press ^D after starting it, it will exit (with an error, because you haven't put in a valid dts). -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-19 2:02 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-10-18 23:28 [PATCH] dtc: Show the usage text if no parameter is passed Fabio Estevam [not found] ` <1508369307-22307-1-git-send-email-festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2017-10-19 0:02 ` 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
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).