Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/mixer/mixer.c
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | main(int argc, char *argv[]) | ||||
struct mixer *m; | struct mixer *m; | ||||
mix_ctl_t *cp; | mix_ctl_t *cp; | ||||
char *name = NULL, buf[NAME_MAX]; | char *name = NULL, buf[NAME_MAX]; | ||||
char *p, *bufp, *devstr, *ctlstr, *valstr = NULL; | char *p, *bufp, *devstr, *ctlstr, *valstr = NULL; | ||||
int dunit, i, n, pall = 1; | int dunit, i, n, pall = 1; | ||||
int aflag = 0, dflag = 0, oflag = 0, sflag = 0; | int aflag = 0, dflag = 0, oflag = 0, sflag = 0; | ||||
int ch; | int ch; | ||||
while ((ch = getopt(argc, argv, "ad:f:os")) != -1) { | while ((ch = getopt(argc, argv, "ad:f:hos")) != -1) { | ||||
switch (ch) { | switch (ch) { | ||||
case 'a': | case 'a': | ||||
aflag = 1; | aflag = 1; | ||||
break; | break; | ||||
case 'd': | case 'd': | ||||
dunit = strtol(optarg, NULL, 10); | dunit = strtol(optarg, NULL, 10); | ||||
if (errno == EINVAL || errno == ERANGE) | if (errno == EINVAL || errno == ERANGE) | ||||
err(1, "strtol"); | err(1, "strtol"); | ||||
dflag = 1; | dflag = 1; | ||||
break; | break; | ||||
case 'f': | case 'f': | ||||
name = optarg; | name = optarg; | ||||
break; | break; | ||||
case 'o': | case 'o': | ||||
oflag = 1; | oflag = 1; | ||||
break; | break; | ||||
case 's': | case 's': | ||||
sflag = 1; | sflag = 1; | ||||
break; | break; | ||||
case 'h': /* FALLTROUGH */ | |||||
case '?': | case '?': | ||||
default: | default: | ||||
usage(); | usage(); | ||||
} | } | ||||
} | } | ||||
argc -= optind; | argc -= optind; | ||||
argv += optind; | argv += optind; | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | next: | ||||
(void)mixer_close(m); | (void)mixer_close(m); | ||||
return (0); | return (0); | ||||
} | } | ||||
static void __dead2 | static void __dead2 | ||||
usage(void) | usage(void) | ||||
{ | { | ||||
printf("usage: %1$s [-f device] [-d unit] [-os] [dev[.control[=value]]] ...\n" | fprintf(stderr, "usage: %1$s [-f device] [-d unit] [-os] [dev[.control[=value]]] ...\n" | ||||
" %1$s [-d unit] [-os] -a\n", | " %1$s [-d unit] [-os] -a\n" | ||||
getprogname()); | " %1$s -h\n", getprogname()); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
static void | static void | ||||
initctls(struct mixer *m) | initctls(struct mixer *m) | ||||
{ | { | ||||
struct mix_dev *dp; | struct mix_dev *dp; | ||||
int rc = 0; | int rc = 0; | ||||
▲ Show 20 Lines • Show All 305 Lines • Show Last 20 Lines |