Fixed the exit code for invalid options. Now returns 1.
int main(int argc, char *argv[])
{
- int morehelp;
struct option long_option[] =
{
{"help", 0, NULL, 'h'},
int res;
command = argv[0];
- morehelp = 0;
while (1) {
int c;
break;
switch (c) {
case 'h':
- morehelp++;
- break;
+ help();
+ return EXIT_SUCCESS;
case 'f':
cfgfile = optarg;
break;
printf("alsactl version " SND_UTIL_VERSION_STR "\n");
return EXIT_SUCCESS;
case '?': // error msg already printed
- morehelp++;
+ help();
+ return EXIT_FAILURE;
break;
default: // should never happen
fprintf(stderr,
"Invalid option '%c' (%d) not handled??\n", c, c);
}
}
- if (morehelp) {
- help();
- return EXIT_SUCCESS;
- }
if (argc - optind <= 0) {
fprintf(stderr, "alsactl: Specify command...\n");
return 0;