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

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


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

When aplay/arecord are 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>
---
 aplay/aplay.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/aplay/aplay.c b/aplay/aplay.c
index 741979a..9cc5063 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -519,6 +519,11 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
+	if (argc == 1) {
+		usage(command);
+		return 0;
+	}
+
 	chunk_size = -1;
 	rhwparams.format = DEFAULT_FORMAT;
 	rhwparams.rate = DEFAULT_SPEED;
-- 
1.7.9.5



More information about the Alsa-devel mailing list