[alsa-devel] [PATCH 2/2] ac3dec: Show usage if no parameter is passed

Fabio Estevam festevam at gmail.com
Mon Nov 12 19:02:33 CET 2012


From: Fabio Estevam <fabio.estevam at freescale.com>

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

Instead of hanging, print the usage and exit.

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 ac3dec/ac3dec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ac3dec/ac3dec.c b/ac3dec/ac3dec.c
index 00c4f1a..f1423e3 100644
--- a/ac3dec/ac3dec.c
+++ b/ac3dec/ac3dec.c
@@ -130,6 +130,11 @@ int main(int argc,char *argv[])
 	out_config.spdif = SPDIF_NONE;
 	out_config.hdmi = 0;
 
+	if (argc == 1) {
+		help();
+		return 0;
+	}
+
 	morehelp = 0;
 	while (1) {
 		int c;
-- 
1.7.9.5



More information about the Alsa-devel mailing list