The argument
.Ar dev
may be abbreviated to its shortest non-ambigious form.
int foo;
int device, i, matches;
for (foo = 0; foo < SOUND_MIXER_NRDEVICES; foo++)
matches = 0;
if ((1 << foo) & mask && !strcmp(names[foo], name))
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
break;
if ((1 << i) & mask
&& !strncmp(names[i], name, strlen(name))) {
device = i;
matches++;
}
return foo == SOUND_MIXER_NRDEVICES ? -1 : foo;
return (matches == 1 ? device : -1);