Index: scheduler/cups-driverd.cxx =================================================================== --- scheduler/cups-driverd.cxx (revision 8789) +++ scheduler/cups-driverd.cxx (working copy) @@ -1493,13 +1493,21 @@ ppd->record.size == dent->fileinfo.st_size && ppd->record.mtime == dent->fileinfo.st_mtime) { - do - { - ppd->found = 1; - } - while ((ppd = (ppd_info_t *)cupsArrayNext(PPDsByName)) != NULL && + /* + * Rewind to the first entry for this file... + */ + + while ((ppd = (ppd_info_t *)cupsArrayPrev(PPDsByName)) != NULL && !strcmp(ppd->record.filename, name)); + /* + * Then mark all of the matches for this file as found... + */ + + while ((ppd = (ppd_info_t *)cupsArrayNext(PPDsByName)) != NULL && + !strcmp(ppd->record.filename, name)) + ppd->found = 1; + continue; } @@ -1904,7 +1912,8 @@ *cups_fax, // cupsFax attribute *nick_name; // NickName attribute ppdcFilter *filter; // Current filter - bool product_found; // Found product? + ppd_info_t *ppd; // Current PPD + int products_found; // Number of products found char uri[1024], // Driver URI make_model[1024]; // Make and model int type; // Driver type @@ -1929,7 +1938,7 @@ * Add a dummy entry for the file... */ - add_ppd(filename, filename, "", "", "", "", "", "", mtime, size, 0, + add_ppd(name, name, "", "", "", "", "", "", mtime, size, 0, PPD_TYPE_DRV, "drv"); ChangedPPD = 1; @@ -1981,22 +1990,28 @@ type = PPD_TYPE_PDF; } - for (product = (ppdcAttr *)d->attrs->first(), product_found = false; + for (product = (ppdcAttr *)d->attrs->first(), products_found = 0; product; product = (ppdcAttr *)d->attrs->next()) if (!strcmp(product->name->value, "Product")) { - product_found = true; + if (!products_found) + ppd = add_ppd(name, uri, "en", d->manufacturer->value, make_model, + device_id ? device_id->value->value : "", + product->value->value, + ps_version ? ps_version->value->value : "(3010) 0", + mtime, size, d->model_number, type, "drv"); + else if (products_found < PPD_MAX_PROD) + strlcpy(ppd->record.products[products_found], product->value->value, + sizeof(ppd->record.products[0])); + else + break; - add_ppd(filename, uri, "en", d->manufacturer->value, make_model, - device_id ? device_id->value->value : "", - product->value->value, - ps_version ? ps_version->value->value : "(3010) 0", - mtime, size, d->model_number, type, "drv"); + products_found ++; } - if (!product_found) - add_ppd(filename, uri, "en", d->manufacturer->value, make_model, + if (!products_found) + add_ppd(name, uri, "en", d->manufacturer->value, make_model, device_id ? device_id->value->value : "", d->model_name->value, ps_version ? ps_version->value->value : "(3010) 0",