~ubuntu-branches/ubuntu/natty/cups/natty

« back to all changes in this revision

Viewing changes to scheduler/cups-driverd.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-09-15 11:30:07 UTC
  • mto: (12.1.3 sid) (14.1.1 sid) (25.1.2 lucid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090915113007-1gngzbskotfxronq
Tags: upstream-1.4.1
ImportĀ upstreamĀ versionĀ 1.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: cups-driverd.cxx 8702 2009-06-08 22:00:14Z mike $"
 
2
 * "$Id: cups-driverd.cxx 8809 2009-08-31 21:26:25Z mike $"
3
3
 *
4
4
 *   PPD/driver support for the Common UNIX Printing System (CUPS).
5
5
 *
328
328
  *pc_file_name++ = '\0';
329
329
 
330
330
#ifdef __APPLE__
331
 
  if (!strncmp(resource, "/Library/Printers/PPDs.drv/", 27))
 
331
  if (!strncmp(resource, "/Library/Printers/PPDs/Contents/Resources/", 42) ||
 
332
      !strncmp(resource, "/System/Library/Printers/PPDs/Contents/Resources/", 49))
332
333
    strlcpy(filename, resource, sizeof(filename));
333
334
  else
334
335
#endif // __APPLE__
1493
1494
        ppd->record.size == dent->fileinfo.st_size &&
1494
1495
        ppd->record.mtime == dent->fileinfo.st_mtime)
1495
1496
    {
1496
 
      do
1497
 
      {
 
1497
     /*
 
1498
      * Rewind to the first entry for this file...
 
1499
      */
 
1500
 
 
1501
      while ((ppd = (ppd_info_t *)cupsArrayPrev(PPDsByName)) != NULL &&
 
1502
             !strcmp(ppd->record.filename, name));
 
1503
 
 
1504
     /*
 
1505
      * Then mark all of the matches for this file as found...
 
1506
      */
 
1507
 
 
1508
      while ((ppd = (ppd_info_t *)cupsArrayNext(PPDsByName)) != NULL &&
 
1509
             !strcmp(ppd->record.filename, name))
1498
1510
        ppd->found = 1;
1499
 
      }
1500
 
      while ((ppd = (ppd_info_t *)cupsArrayNext(PPDsByName)) != NULL &&
1501
 
             !strcmp(ppd->record.filename, name));
1502
1511
 
1503
1512
      continue;
1504
1513
    }
1904
1913
                *cups_fax,              // cupsFax attribute
1905
1914
                *nick_name;             // NickName attribute
1906
1915
  ppdcFilter    *filter;                // Current filter
1907
 
  bool          product_found;          // Found product?
 
1916
  ppd_info_t    *ppd;                   // Current PPD
 
1917
  int           products_found;         // Number of products found
1908
1918
  char          uri[1024],              // Driver URI
1909
1919
                make_model[1024];       // Make and model
1910
1920
  int           type;                   // Driver type
1929
1939
  * Add a dummy entry for the file...
1930
1940
  */
1931
1941
 
1932
 
  add_ppd(filename, filename, "", "", "", "", "", "", mtime, size, 0,
 
1942
  add_ppd(name, name, "", "", "", "", "", "", mtime, size, 0,
1933
1943
          PPD_TYPE_DRV, "drv");
1934
1944
  ChangedPPD = 1;
1935
1945
 
1981
1991
          type = PPD_TYPE_PDF;
1982
1992
    }
1983
1993
 
1984
 
    for (product = (ppdcAttr *)d->attrs->first(), product_found = false;
 
1994
    for (product = (ppdcAttr *)d->attrs->first(), products_found = 0;
1985
1995
         product;
1986
1996
         product = (ppdcAttr *)d->attrs->next())
1987
1997
      if (!strcmp(product->name->value, "Product"))
1988
1998
      {
1989
 
        product_found = true;
 
1999
        if (!products_found)
 
2000
          ppd = add_ppd(name, uri, "en", d->manufacturer->value, make_model,
 
2001
                        device_id ? device_id->value->value : "",
 
2002
                        product->value->value,
 
2003
                        ps_version ? ps_version->value->value : "(3010) 0",
 
2004
                        mtime, size, d->model_number, type, "drv");
 
2005
        else if (products_found < PPD_MAX_PROD)
 
2006
          strlcpy(ppd->record.products[products_found], product->value->value,
 
2007
                  sizeof(ppd->record.products[0]));
 
2008
        else
 
2009
          break;
1990
2010
 
1991
 
        add_ppd(filename, uri, "en", d->manufacturer->value, make_model,
1992
 
                device_id ? device_id->value->value : "",
1993
 
                product->value->value,
1994
 
                ps_version ? ps_version->value->value : "(3010) 0",
1995
 
                mtime, size, d->model_number, type, "drv");
 
2011
        products_found ++;
1996
2012
      }
1997
2013
 
1998
 
    if (!product_found)
1999
 
      add_ppd(filename, uri, "en", d->manufacturer->value, make_model,
 
2014
    if (!products_found)
 
2015
      add_ppd(name, uri, "en", d->manufacturer->value, make_model,
2000
2016
              device_id ? device_id->value->value : "",
2001
2017
              d->model_name->value,
2002
2018
              ps_version ? ps_version->value->value : "(3010) 0",
2460
2476
 
2461
2477
 
2462
2478
/*
2463
 
 * End of "$Id: cups-driverd.cxx 8702 2009-06-08 22:00:14Z mike $".
 
2479
 * End of "$Id: cups-driverd.cxx 8809 2009-08-31 21:26:25Z mike $".
2464
2480
 */