/*
- * "$Id: emit.c,v 1.23.2.10 2003/06/02 20:24:19 mike Exp $"
+ * "$Id: emit.c,v 1.23.2.11 2003/06/07 16:35:54 mike Exp $"
*
* PPD code emission routines for the Common UNIX Printing System (CUPS).
*
job_id, user, temp);
}
else
- fputs(ppd->jcl_begin, stdout);
+ fputs(ppd->jcl_begin, fp);
- ppdEmit(ppd, stdout, PPD_ORDER_JCL);
- fputs(ppd->jcl_ps, stdout);
+ ppdEmit(ppd, fp, PPD_ORDER_JCL);
+ fputs(ppd->jcl_ps, fp);
return (0);
}
/*
- * End of "$Id: emit.c,v 1.23.2.10 2003/06/02 20:24:19 mike Exp $".
+ * End of "$Id: emit.c,v 1.23.2.11 2003/06/07 16:35:54 mike Exp $".
*/
/*
- * "$Id: ppd.c,v 1.51.2.51 2003/04/11 13:07:36 mike Exp $"
+ * "$Id: ppd.c,v 1.51.2.52 2003/06/07 16:35:54 mike Exp $"
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
ppd->color_device = strcmp(string, "True") == 0;
else if (strcmp(keyword, "ContoneOnly") == 0)
ppd->contone_only = strcmp(string, "True") == 0;
- else if (strcmp(keyword, "DefaultColorSpace") == 0)
- {
- if (strcmp(string, "CMY") == 0)
- ppd->colorspace = PPD_CS_CMY;
- else if (strcmp(string, "CMYK") == 0)
- ppd->colorspace = PPD_CS_CMYK;
- else if (strcmp(string, "RGB") == 0)
- ppd->colorspace = PPD_CS_RGB;
- else if (strcmp(string, "RGBK") == 0)
- ppd->colorspace = PPD_CS_RGBK;
- else if (strcmp(string, "N") == 0)
- ppd->colorspace = PPD_CS_N;
- else
- ppd->colorspace = PPD_CS_GRAY;
- }
else if (strcmp(keyword, "cupsFlipDuplex") == 0)
ppd->flip_duplex = strcmp(string, "True") == 0;
else if (strcmp(keyword, "cupsManualCopies") == 0)
if (string == NULL)
continue;
+ /*
+ * Drop UI text, if any, from value...
+ */
+
if (strchr(string, '/') != NULL)
*strchr(string, '/') = '\0';
- if (option == NULL)
- {
- if ((option = ppdFindOption(ppd, keyword + 7)) != NULL)
- {
- strlcpy(option->defchoice, string, sizeof(option->defchoice));
- option = NULL;
- }
- else
- {
- /*
- * Option not found; add this as an attribute...
- */
+ /*
+ * Assign the default value as appropriate...
+ */
- ppd_add_attr(ppd, keyword, "", "", string);
+ if (strcmp(keyword, "DefaultColorSpace") == 0)
+ {
+ /*
+ * Set default colorspace...
+ */
- string = NULL; /* Don't free this string below */
- }
+ if (strcmp(string, "CMY") == 0)
+ ppd->colorspace = PPD_CS_CMY;
+ else if (strcmp(string, "CMYK") == 0)
+ ppd->colorspace = PPD_CS_CMYK;
+ else if (strcmp(string, "RGB") == 0)
+ ppd->colorspace = PPD_CS_RGB;
+ else if (strcmp(string, "RGBK") == 0)
+ ppd->colorspace = PPD_CS_RGBK;
+ else if (strcmp(string, "N") == 0)
+ ppd->colorspace = PPD_CS_N;
+ else
+ ppd->colorspace = PPD_CS_GRAY;
}
- else if (strcmp(keyword + 7, option->keyword) == 0)
+ else if (option && strcmp(keyword + 7, option->keyword) == 0)
+ {
+ /*
+ * Set the default as part of the current option...
+ */
+
strlcpy(option->defchoice, string, sizeof(option->defchoice));
+ }
else
{
/*
- * Default doesn't match this option; add as an attribute...
+ * Lookup option and set if it has been defined...
*/
- ppd_add_attr(ppd, keyword, "", "", string);
+ ppd_option_t *toption; /* Temporary option */
+
- string = NULL; /* Don't free this string below */
+ if ((toption = ppdFindOption(ppd, keyword + 7)) != NULL)
+ strlcpy(toption->defchoice, string, sizeof(toption->defchoice));
}
+
+ /*
+ * Add default as attribute, too...
+ */
+
+ ppd_add_attr(ppd, keyword, "", "", string);
+
+ string = NULL; /* Don't free this string below */
}
else if (strcmp(keyword, "UIConstraints") == 0 ||
strcmp(keyword, "NonUIConstraints") == 0)
/*
- * End of "$Id: ppd.c,v 1.51.2.51 2003/04/11 13:07:36 mike Exp $".
+ * End of "$Id: ppd.c,v 1.51.2.52 2003/06/07 16:35:54 mike Exp $".
*/
/*
- * "$Id: cupstestppd.c,v 1.1.2.22 2003/05/23 15:25:11 mike Exp $"
+ * "$Id: cupstestppd.c,v 1.1.2.23 2003/06/07 16:35:56 mike Exp $"
*
* PPD test program for the Common UNIX Printing System (CUPS).
*
printf(" num_fonts = %d\n", ppd->num_fonts);
for (j = 0; j < ppd->num_fonts; j ++)
printf(" fonts[%d] = %s\n", j, ppd->fonts[j]);
+
+ printf(" num_attrs = %d\n", ppd->num_attrs);
+ for (j = 0; j < ppd->num_attrs; j ++)
+ printf(" attrs[%d] = %s %s%s%s: \"%s\"\n", j,
+ ppd->attrs[j]->name, ppd->attrs[j]->spec,
+ ppd->attrs[j]->text[0] ? "/" : "", ppd->attrs[j]->text,
+ ppd->attrs[j]->value ? ppd->attrs[j]->value : "(null)");
}
ppdClose(ppd);
/*
- * End of "$Id: cupstestppd.c,v 1.1.2.22 2003/05/23 15:25:11 mike Exp $".
+ * End of "$Id: cupstestppd.c,v 1.1.2.23 2003/06/07 16:35:56 mike Exp $".
*/