Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/mixer/mixer.c
| Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | main(int argc, char *argv[]) | ||||
| if (sflag) { | if (sflag) { | ||||
| printrecsrc(m, oflag); | printrecsrc(m, oflag); | ||||
| (void)mixer_close(m); | (void)mixer_close(m); | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| parse: | parse: | ||||
| while (argc > 0) { | while (argc > 0) { | ||||
| if ((p = strdup(*argv)) == NULL) | char *orig; | ||||
| if ((orig = p = strdup(*argv)) == NULL) | |||||
| err(1, "strdup(%s)", *argv); | err(1, "strdup(%s)", *argv); | ||||
| /* Check if we're using the shorthand syntax for volume setting. */ | /* Check if we're using the shorthand syntax for volume setting. */ | ||||
| shorthand = 0; | shorthand = 0; | ||||
| for (q = p; *q != '\0'; q++) { | for (q = p; *q != '\0'; q++) { | ||||
| if (*q == '=') { | if (*q == '=') { | ||||
| q++; | q++; | ||||
| shorthand = ((*q >= '0' && *q <= '9') || | shorthand = ((*q >= '0' && *q <= '9') || | ||||
| Show All 36 Lines | if (p == NULL) { | ||||
| (void)cp->print(cp->parent_dev, cp->name); | (void)cp->print(cp->parent_dev, cp->name); | ||||
| pall = 0; | pall = 0; | ||||
| goto next; | goto next; | ||||
| } | } | ||||
| valstr = p; | valstr = p; | ||||
| /* Input: `dev.control=val`. */ | /* Input: `dev.control=val`. */ | ||||
| cp->mod(cp->parent_dev, valstr); | cp->mod(cp->parent_dev, valstr); | ||||
| next: | next: | ||||
| free(p); | free(orig); | ||||
| argc--; | argc--; | ||||
| argv++; | argv++; | ||||
| } | } | ||||
| if (pall) | if (pall) | ||||
| printall(m, oflag); | printall(m, oflag); | ||||
| (void)mixer_close(m); | (void)mixer_close(m); | ||||
| ▲ Show 20 Lines • Show All 384 Lines • Show Last 20 Lines | |||||