]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add script to determine the maximum number of products in installed PPDs.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 22 May 2009 15:37:36 +0000 (15:37 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 22 May 2009 15:37:36 +0000 (15:37 +0000)
Bump the maximum number of Product and PSVersion keywords per PPD to 32.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@8670 7a7537e8-13f0-0310-91df-b6672ffda945

scheduler/cups-driverd.cxx
tools/products.php [new file with mode: 0755]

index 7383145cc04f7e7e34d2ecf55abb66b903163115..f52527f7f7a683e9074113d0ecbd0e0cefcc5795 100644 (file)
  * Constants...
  */
 
-#define PPD_SYNC       0x50504436      /* Sync word for ppds.dat (PPD6) */
+#define PPD_SYNC       0x50504437      /* Sync word for ppds.dat (PPD7) */
 #define PPD_MAX_LANG   32              /* Maximum languages */
-#define PPD_MAX_PROD                 /* Maximum products */
-#define PPD_MAX_VERS                 /* Maximum versions */
+#define PPD_MAX_PROD   32              /* Maximum products */
+#define PPD_MAX_VERS   32              /* Maximum versions */
 
 #define PPD_TYPE_POSTSCRIPT    0       /* PostScript PPD */
 #define PPD_TYPE_PDF           1       /* PDF PPD */
diff --git a/tools/products.php b/tools/products.php
new file mode 100755 (executable)
index 0000000..9c2e743
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/php -f
+<?php
+
+$fp     = popen("zgrep '^\\*Product:' /Library/Printers/PPDs/Contents/Resources/*.gz", "r");
+$files  = array();
+$maxlen = 0;
+
+while ($line = fgets($fp, 1024))
+{
+  $data = explode(":", $line);
+  if (array_key_exists($data[0], $files))
+    $files[$data[0]] ++;
+  else
+    $files[$data[0]] = 1;
+
+  $data = explode("\"", $line);
+  if (strlen($data[1]) > $maxlen)
+    $maxlen = strlen($data[1]);
+}
+
+pclose($fp);
+
+arsort($files);
+
+$current_count = 0;
+$current_files = 0;
+
+foreach ($files as $file => $count)
+{
+  if ($current_count == 0)
+    print(basename($file) . "  => $count products\n");
+
+  if ($count != $current_count)
+  {
+    if ($current_count != 0)
+      print("$current_files PPDs with $current_count products.\n");
+
+    $current_count = $count;
+    $current_files = 1;
+  }
+  else
+    $current_files ++;
+}
+
+if ($current_count != 0)
+  print("$current_files PPDs with $current_count products.\n");
+
+print("Maximum length of Product string: $maxlen\n");
+
+?>