Better handling of command line in rds_wav.c

This commit is contained in:
Christophe Jacquet 2014-04-14 17:32:04 +02:00
parent e758ee63a0
commit dad13529a3
1 changed files with 7 additions and 3 deletions

View File

@ -46,7 +46,10 @@ int main(int argc, char **argv) {
set_rds_ps(argv[3]); set_rds_ps(argv[3]);
set_rds_rt(argv[3]); set_rds_rt(argv[3]);
if(fm_mpx_open(argv[1], LENGTH) != 0) { char *in_file = argv[1];
if(strcmp("NONE", argv[1]) == 0) in_file = NULL;
if(fm_mpx_open(in_file, LENGTH) != 0) {
printf("Could not setup FM mulitplex generator.\n"); printf("Could not setup FM mulitplex generator.\n");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -65,8 +68,9 @@ int main(int argc, char **argv) {
sfinfo.seekable = 0; sfinfo.seekable = 0;
// Open the output file // Open the output file
if (! (outf = sf_open(argv[2], SFM_WRITE, &sfinfo))) { char *out_file = argv[2];
fprintf(stderr, "Error: could not open output file %s.\n", argv[2]) ; if (! (outf = sf_open(out_file, SFM_WRITE, &sfinfo))) {
fprintf(stderr, "Error: could not open output file %s.\n", out_file);
return EXIT_FAILURE; return EXIT_FAILURE;
} }