mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-09-19 17:49:59 +02:00
amixer: don't show help on argument parsing error
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
71003a2acb
commit
bc80344625
1 changed files with 10 additions and 11 deletions
|
@ -1772,7 +1772,7 @@ static int exec_stdin(void)
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int morehelp, retval, level = 0;
|
int badopt, retval, level = 0;
|
||||||
int read_stdin = 0;
|
int read_stdin = 0;
|
||||||
static const struct option long_option[] =
|
static const struct option long_option[] =
|
||||||
{
|
{
|
||||||
|
@ -1791,7 +1791,7 @@ int main(int argc, char *argv[])
|
||||||
{NULL, 0, NULL, 0},
|
{NULL, 0, NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
morehelp = 0;
|
badopt = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -1812,8 +1812,8 @@ int main(int argc, char *argv[])
|
||||||
sprintf(card, "hw:%i", i);
|
sprintf(card, "hw:%i", i);
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Invalid card number.\n");
|
fprintf(stderr, "Invalid card number '%s'.\n", optarg);
|
||||||
morehelp++;
|
badopt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1835,7 +1835,7 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("amixer version " SND_UTIL_VERSION_STR "\n");
|
printf("amixer version " SND_UTIL_VERSION_STR "\n");
|
||||||
return 1;
|
return 0;
|
||||||
case 'a':
|
case 'a':
|
||||||
smixer_level = 1;
|
smixer_level = 1;
|
||||||
memset(&smixer_options, 0, sizeof(smixer_options));
|
memset(&smixer_options, 0, sizeof(smixer_options));
|
||||||
|
@ -1846,7 +1846,7 @@ int main(int argc, char *argv[])
|
||||||
smixer_options.abstract = SND_MIXER_SABSTRACT_BASIC;
|
smixer_options.abstract = SND_MIXER_SABSTRACT_BASIC;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Select correct abstraction level (none or basic)...\n");
|
fprintf(stderr, "Select correct abstraction level (none or basic)...\n");
|
||||||
morehelp++;
|
badopt++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
|
@ -1859,14 +1859,13 @@ int main(int argc, char *argv[])
|
||||||
std_vol_type = VOL_MAP;
|
std_vol_type = VOL_MAP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Invalid switch or option needs an argument.\n");
|
fprintf(stderr, "Invalid switch or option -%c needs an argument.\n", c);
|
||||||
morehelp++;
|
badopt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (morehelp) {
|
if (badopt)
|
||||||
help();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
smixer_options.device = card;
|
smixer_options.device = card;
|
||||||
|
|
||||||
if (read_stdin) {
|
if (read_stdin) {
|
||||||
|
|
Loading…
Reference in a new issue