aplay: Show usage if no parameter is passed
PATCH 1/2 aplay: Show usage if no parameter is passed
From: Fabio Estevam <[email protected]>
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 <[email protected]>
--- aplay/aplay.c | 5 +++++ 1 file changed, 5 insertions(+)
aplay/aplay.c +5 -0
@@ -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 ;
Signature · 1 line
1.7.9.5
PATCH 2/2 ac3dec: Show usage if no parameter is passed
From: Fabio Estevam <[email protected]>
When ac3dec is called without any argument the application hangs forever.
Instead of hanging, print the usage and exit.
Signed-off-by Fabio Estevam <[email protected]>
--- ac3dec/ac3dec.c | 5 +++++ 1 file changed, 5 insertions(+)
ac3dec/ac3dec.c +5 -0
@@ -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;
Signature · 1 line
1.7.9.5
aplay/aplay.c int main(int argc, char *argv[]) · line 525
Quoted 8 lines · Fabio Estevam
When aplay/arecord are called without any argument the application hangs forever.
Instead of hanging, print the usage and exit.
aplay/aplay.c +4
-0+if (argc ==1 ) { +usage (command); +return 0 ; + }
It's possible to call it with "aplay < somefile".
Better add a check like isatty(fileno(stdin)).
Regards,
Clemens