/*
- * "$Id$"
- *
* PPD/driver support for CUPS.
*
* This program handles listing and installing static PPD files, PPD files
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*/
/*
* Constants...
*/
-#define PPD_SYNC 0x50504437 /* Sync word for ppds.dat (PPD7) */
+#define PPD_SYNC 0x50504439 /* Sync word for ppds.dat (PPD9) */
#define PPD_MAX_LANG 32 /* Maximum languages */
#define PPD_MAX_PROD 32 /* Maximum products */
#define PPD_MAX_VERS 32 /* Maximum versions */
#define PPD_TYPE_PDF 1 /* PDF PPD */
#define PPD_TYPE_RASTER 2 /* CUPS raster PPD */
#define PPD_TYPE_FAX 3 /* Facsimile/MFD PPD */
-#define PPD_TYPE_UNKNOWN 4 /* Other/hybrid PPD */
-#define PPD_TYPE_DRV 5 /* Driver info file */
-#define PPD_TYPE_ARCHIVE 6 /* Archive file */
+#define PPD_TYPE_OBJECT_ANY 4 /* 3D (AMF/STL/g-code) PPD */
+#define PPD_TYPE_OBJECT_DIRECT 5 /* 3D (AMF/STL/g-code) PPD over any connection */
+#define PPD_TYPE_OBJECT_STORAGE 6 /* 3D (AMF/STL/g-code) PPD for storage to SD card, etc. */
+#define PPD_TYPE_UNKNOWN 7 /* Other/hybrid PPD */
+#define PPD_TYPE_DRV 8 /* Driver info file */
+#define PPD_TYPE_ARCHIVE 9 /* Archive file */
#define TAR_BLOCK 512 /* Number of bytes in a block */
#define TAR_BLOCKS 10 /* Blocking factor */
int model_number; /* cupsModelNumber */
int type; /* ppd-type */
char filename[512], /* Filename */
- name[512], /* PPD name */
+ name[256], /* PPD name */
languages[PPD_MAX_LANG][6],
/* LanguageVersion/cupsLanguages */
products[PPD_MAX_PROD][128],
"pdf",
"raster",
"fax",
+ "object",
+ "object-direct",
+ "object-storage",
"unknown",
"drv",
"archive"
* Figure out if this is a static or dynamic PPD file...
*/
+ if (strstr(name, "../"))
+ {
+ fputs("ERROR: Invalid PPD name.\n", stderr);
+ return (1);
+ }
+
strlcpy(scheme, name, sizeof(scheme));
if ((sptr = strchr(scheme, ':')) != NULL)
{
slash > printerDriver))
{
/*
- * Map ppd-name to OS X standard locations...
+ * Map ppd-name to macOS standard locations...
*/
snprintf(buffer, bufsize, "/%s", name);
#ifdef __APPLE__
/*
- * Load PPDs from standard OS X locations...
+ * Load PPDs from standard macOS locations...
*/
load_ppds("/Library/Printers",
load_drivers(include, exclude);
/*
- * Add the raw and IPP Everywhere drivers...
+ * Add the raw driver...
*/
- add_ppd("", "everywhere", "en", "Generic", "IPP Everywhere", "", "", "", 0, 0, 0, PPD_TYPE_UNKNOWN, "everywhere");
- add_ppd("", "raw", "en", "Raw", "Raw Queue", "", "", "", 0, 0, 0, PPD_TYPE_UNKNOWN, "raw");
+ add_ppd("", "raw", "en", "Raw", "Raw Queue", "", "", "", 0, 0, 0,
+ PPD_TYPE_UNKNOWN, "raw");
/*
* Send IPP attributes...
char *argv[3], /* Arguments for command */
filename[1024], /* Name of driver */
line[2048], /* Line from driver */
- name[512], /* ppd-name */
+ name[256], /* ppd-name */
make[128], /* ppd-make */
make_and_model[128], /* ppd-make-and-model */
device_id[256], /* ppd-device-id */
psversion[0] = '\0';
strlcpy(type_str, "postscript", sizeof(type_str));
- if (sscanf(line, "\"%511[^\"]\"%127s%*[ \t]\"%127[^\"]\""
+ if (sscanf(line, "\"%255[^\"]\"%127s%*[ \t]\"%127[^\"]\""
"%*[ \t]\"%127[^\"]\"%*[ \t]\"%255[^\"]\""
"%*[ \t]\"%127[^\"]\"%*[ \t]\"%127[^\"]\""
"%*[ \t]\"%127[^\"]\"",
if (!_cups_strncasecmp(ptr, "true", 4))
type = PPD_TYPE_FAX;
}
- else if (!strncmp(line, "*cupsFilter:", 12) && type == PPD_TYPE_POSTSCRIPT)
+ else if ((!strncmp(line, "*cupsFilter:", 12) || !strncmp(line, "*cupsFilter2:", 13)) && type == PPD_TYPE_POSTSCRIPT)
{
if (strstr(line + 12, "application/vnd.cups-raster"))
type = PPD_TYPE_RASTER;
else if (strstr(line + 12, "application/vnd.cups-pdf"))
type = PPD_TYPE_PDF;
+ else if (strstr(line + 12, "application/amf") ||
+ strstr(line + 12, "application/g-code") ||
+ strstr(line + 12, "application/sla"))
+ type = PPD_TYPE_OBJECT_ANY;
+ }
+ else if (!strncmp(line, "*cups3DWorkflows:", 17))
+ {
+ int is_direct = strstr(line + 17, "direct") != NULL;
+ int is_storage = strstr(line + 17, "storage") != NULL;
+
+ if (is_direct && !is_storage)
+ type = PPD_TYPE_OBJECT_DIRECT;
+ if (!is_direct && is_storage)
+ type = PPD_TYPE_OBJECT_STORAGE;
+ else
+ type = PPD_TYPE_OBJECT_ANY;
}
else if (!strncmp(line, "*cupsModelNumber:", 17))
sscanf(line, "*cupsModelNumber:%d", &model_number);
char filename[1024], /* Name of PPD or directory */
line[256], /* Line from file */
*ptr, /* Pointer into name */
- name[128]; /* Name of PPD file */
+ name[256]; /* Name of PPD file */
ppd_info_t *ppd, /* New PPD file */
key; /* Search key */
return (NULL);
}
-
-
-/*
- * End of "$Id$".
- */