/*
- * "$Id: printers.c 7608 2008-05-21 01:37:21Z mike $"
+ * "$Id: printers.c 7677 2008-06-19 23:22:19Z mike $"
*
* Printer routines for the Common UNIX Printing System (CUPS).
*
if (!Printers)
Printers = cupsArrayNew(compare_printers, NULL);
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdAddPrinter: Adding %s to Printers", p->name);
cupsArrayAdd(Printers, p);
if (!ImplicitPrinters)
static const char * const errors[] = /* printer-error-policy-supported values */
{
"abort-job",
+ "retry-current-job",
"retry-job",
"stop-printer"
};
* Remove the printer from the list...
*/
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdDeletePrinter: Removing %s from Printers", p->name);
cupsArrayRemove(Printers, p);
if (p->type & CUPS_PRINTER_IMPLICIT)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdDeletePrinter: Removing %s from ImplicitPrinters",
+ p->name);
cupsArrayRemove(ImplicitPrinters, p);
+ }
/*
* Remove the dummy interface/icon/option files under IRIX...
for (value = valueptr; *valueptr && !isspace(*valueptr & 255); valueptr ++);
if (*valueptr)
- *valueptr++ = '\0';
+ *valueptr = '\0';
cupsdSetString(&p->job_sheets[1], value);
}
* Remove the printer from the array(s) first...
*/
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdRenamePrinter: Removing %s from Printers", p->name);
cupsArrayRemove(Printers, p);
if (p->type & CUPS_PRINTER_IMPLICIT)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdRenamePrinter: Removing %s from ImplicitPrinters",
+ p->name);
cupsArrayRemove(ImplicitPrinters, p);
+ }
/*
* Rename the printer type...
* Add the printer back to the printer array(s)...
*/
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdRenamePrinter: Adding %s to Printers", p->name);
cupsArrayAdd(Printers, p);
if (p->type & CUPS_PRINTER_IMPLICIT)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdRenamePrinter: Adding %s to ImplicitPrinters",
+ p->name);
cupsArrayAdd(ImplicitPrinters, p);
+ }
}
cupsFilePuts(fp, "\n");
}
+ if ((marker = ippFindAttribute(printer->attrs, "marker-message",
+ IPP_TAG_TEXT)) != NULL)
+ {
+ cupsFilePrintf(fp, "Attribute %s ", marker->name);
+
+ if ((ptr = strchr(marker->values[0].string.text, '#')) != NULL)
+ {
+ cupsFileWrite(fp, marker->values[0].string.text,
+ ptr - marker->values[0].string.text);
+ cupsFilePutChar(fp, '\\');
+ cupsFilePuts(fp, ptr);
+ }
+ else
+ cupsFilePuts(fp, marker->values[0].string.text);
+
+ cupsFilePuts(fp, "\n");
+ }
+
if ((marker = ippFindAttribute(printer->attrs, "marker-names",
IPP_TAG_NAME)) != NULL)
{
if (!strcmp(name, "marker-types"))
value_tag = IPP_TAG_KEYWORD;
+ else if (!strcmp(name, "marker-message"))
+ value_tag = IPP_TAG_TEXT;
else
value_tag = IPP_TAG_NAME;
}
if (attr)
+ {
+ for (i = 0; i < attr->num_values; i ++)
+ _cupsStrFree(attr->values[i].string.text);
+
attr->num_values = count;
+ }
else
attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, value_tag, name,
count, NULL, NULL);
if ((ptr = strchr(value, ',')) != NULL)
*ptr++ = '\0';
- _cupsStrFree(attr->values[i].string.text);
attr->values[i].string.text = _cupsStrAlloc(value);
if (ptr)
if (p->num_printers > 0)
{
/*
- * Add a list of member URIs and names...
+ * Add a list of member names; URIs are added in copy_printer_attrs...
*/
- attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI,
- "member-uris", p->num_printers, NULL, NULL);
+ attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME,
+ "member-names", p->num_printers, NULL, NULL);
p->type |= CUPS_PRINTER_OPTIONS;
for (i = 0; i < p->num_printers; i ++)
{
if (attr != NULL)
- attr->values[i].string.text = _cupsStrAlloc(p->printers[i]->uri);
+ attr->values[i].string.text = _cupsStrAlloc(p->printers[i]->name);
p->type &= ~CUPS_PRINTER_OPTIONS | p->printers[i]->type;
}
-
- attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME,
- "member-names", p->num_printers, NULL, NULL);
-
- if (attr != NULL)
- {
- for (i = 0; i < p->num_printers; i ++)
- attr->values[i].string.text = _cupsStrAlloc(p->printers[i]->name);
- }
}
}
else
if ((duplex = ppdFindOption(ppd, "KD03Duplex")) == NULL)
duplex = ppdFindOption(ppd, "JCLDuplex");
- if (duplex && duplex->num_choices > 1)
+ if (duplex && duplex->num_choices > 1 &&
+ !ppdInstallableConflict(ppd, duplex->keyword, "DuplexTumble"))
{
p->type |= CUPS_PRINTER_DUPLEX;
* Add all of the default options from the .conf files...
*/
- for (num_options = 0, i = p->num_options, option = p->options;
+ for (num_options = 0, options = NULL, i = p->num_options, option = p->options;
i > 0;
i --, option ++)
{
1);
if (!cupsGetOption("document-format", p->num_options, p->options))
- ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_MIMETYPE,
+ ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_MIMETYPE,
"document-format-default", NULL, "application/octet-stream");
if (!cupsGetOption("job-hold-until", p->num_options, p->options))
* super/type cost program
*/
- if (sscanf(filter, "%15[^/]/%31s%d%1023s", super, type, &cost, program) != 4)
+ if (sscanf(filter, "%15[^/]/%31s%d%*[ \t]%1023[^\n]", super, type, &cost,
+ program) != 4)
{
cupsdLogMessage(CUPSD_LOG_ERROR, "%s: invalid filter string \"%s\"!",
p->name, filter);
/*
- * End of "$Id: printers.c 7608 2008-05-21 01:37:21Z mike $".
+ * End of "$Id: printers.c 7677 2008-06-19 23:22:19Z mike $".
*/