diff --git a/airupnp/src/airupnp.c b/airupnp/src/airupnp.c index 16cf37c4..00066b2f 100644 --- a/airupnp/src/airupnp.c +++ b/airupnp/src/airupnp.c @@ -126,6 +126,7 @@ static char glHostName[_STR_LEN_]; static struct mdnsd* glmDNSServer = NULL; static char* glExcluded = NULL; static char* glExcludedModelNumber = NULL; +static char* glIncludedModelNumbers = NULL; static char *glPidFile = NULL; static bool glAutoSaveConfigFile = false; static bool glGracefullShutdown = true; @@ -157,6 +158,7 @@ static char usage[] = " -p \t\twrite PID in file\n" " -m \texclude from search devices whose model name contains name1 or name 2 ...\n" " -n \texclude from search devices whose model number contains name1 or name 2 ...\n" + " -o \tinclude only the model numbers listed; overrides -m and -n ...\n" " -d =\tSet logging level, logs: all|raop|main|util|upnp, level: error|warn|info|debug|sdebug\n" #if LINUX || FREEBSD @@ -1021,6 +1023,16 @@ bool isExcluded(char *Model, char *ModelNumber) char item[_STR_LEN_]; char *p = glExcluded; char *q = glExcludedModelNumber; + char *o = glIncludedModelNumbers; + + if (glIncludedModelNumbers) { + do { + sscanf(o, "%[^,]", item); + if (stristr(ModelNumber, item)) return false; + o += strlen(item); + } while (*o++); + return true; + } if (glExcluded) { do { @@ -1214,7 +1226,7 @@ bool ParseArgs(int argc, char **argv) { while (optind < argc && strlen(argv[optind]) >= 2 && argv[optind][0] == '-') { char *opt = argv[optind] + 1; - if (strstr("bxdpifmnlc", opt) && optind < argc - 1) { + if (strstr("bxdpifmnolc", opt) && optind < argc - 1) { optarg = argv[optind + 1]; optind += 2; } else if (strstr("tzZIkr", opt)) { @@ -1261,6 +1273,9 @@ bool ParseArgs(int argc, char **argv) { case 'n': glExcludedModelNumber = optarg; break; + case 'o': + glIncludedModelNumbers = optarg; + break; case 'l': strcpy(glMRConfig.Latency, optarg); break;