else if (!strncmp(reason, "media-jam", 9))
message = _("Media jam!");
else if (!strncmp(reason, "moving-to-paused", 16) ||
+ !strncmp(reason, "offline", 7) ||
!strncmp(reason, "paused", 6) ||
!strncmp(reason, "shutdown", 8))
message = _("Printer offline.");
if ((datadir = getenv("CUPS_DATADIR")) == NULL)
datadir = CUPS_DATADIR;
- snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir);
+ snprintf(filename, sizeof(filename), "%s/data/testprint", datadir);
/*
* Point to the printer/class...
{
ppd_attr_t key, /* Search key */
*attr; /* Current attribute */
- int diff; /* Current difference */
DEBUG_printf(("ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")\n", ppd,
memset(&key, 0, sizeof(key));
strlcpy(key.name, name, sizeof(key.name));
- if (spec)
- strlcpy(key.spec, spec, sizeof(key.spec));
/*
* Return the first matching attribute, if any...
*/
if ((attr = (ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key)) != NULL)
- return (attr);
- else if (spec)
- return (NULL);
-
- /*
- * No match found, loop through the sorted attributes to see if we can
- * find a "wildcard" match for the attribute...
- */
-
- for (attr = (ppd_attr_t *)cupsArrayFirst(ppd->sorted_attrs);
- attr;
- attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs))
{
- if ((diff = strcasecmp(attr->name, name)) == 0)
- break;
-
- if (diff > 0)
+ if (spec)
{
/*
- * All remaining attributes are > than the one we are trying to find...
+ * Loop until we find the first matching attribute for "spec"...
*/
- cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
-
- return (NULL);
+ while (attr && strcasecmp(spec, attr->spec))
+ {
+ if ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL &&
+ strcasecmp(attr->name, name))
+ attr = NULL;
+ }
}
}
* Range check input...
*/
- if (!ppd || !name || ppd->num_attrs == 0 ||
- !cupsArrayCurrent(ppd->sorted_attrs))
+ if (!ppd || !name || ppd->num_attrs == 0)
return (NULL);
/*
* See if there are more attributes to return...
*/
- if ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) == NULL)
- return (NULL);
-
- /*
- * Check the next attribute to see if it is a match...
- */
-
- if (strcasecmp(attr->name, name) || (spec && strcasecmp(attr->spec, spec)))
+ while ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL)
{
/*
- * Nope, reset the current pointer to the end of the array...
+ * Check the next attribute to see if it is a match...
*/
- cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
+ if (strcasecmp(attr->name, name))
+ {
+ /*
+ * Nope, reset the current pointer to the end of the array...
+ */
- return (NULL);
+ cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
+
+ return (NULL);
+ }
+
+ if (!spec || !strcasecmp(attr->spec, spec))
+ break;
}
-
+
/*
* Return the next attribute's value...
*/
ppd_compare_attrs(ppd_attr_t *a, /* I - First attribute */
ppd_attr_t *b) /* I - Second attribute */
{
- int ret; /* Result of comparison */
-
-
- if ((ret = strcasecmp(a->name, b->name)) != 0)
- return (ret);
- else
- return (strcasecmp(a->spec, b->spec));
+ return (strcasecmp(a->name, b->name));
}
*UIConstraints: "*Duplex *InstalledDuplexer False"
*UIConstraints: "*InstalledDuplexer False *Duplex"
+*% These attributes test ppdFindAttr/ppdFindNext...
+*cupsTest Foo/I Love Foo: ""
+*cupsTest Bar/I Love Bar: ""
+
*% For PageSize, we have put all of the translations in-line...
*OpenUI *PageSize/Page Size: PickOne
*fr.Translation PageSize/French Page Size: ""
cups_option_t *options; /* Options */
ppd_size_t minsize, /* Minimum size */
maxsize; /* Maximum size */
+ ppd_attr_t *attr; /* Current attribute */
status = 0;
printf("FAIL (%s on line %d)\n", ppdErrorString(err), line);
}
+ fputs("ppdFindAttr(wildcard): ", stdout);
+ if ((attr = ppdFindAttr(ppd, "cupsTest", NULL)) == NULL)
+ {
+ status ++;
+ puts("FAIL (not found)");
+ }
+ else if (strcmp(attr->name, "cupsTest") || strcmp(attr->spec, "Foo"))
+ {
+ status ++;
+ printf("FAIL (got \"%s %s\")\n", attr->name, attr->spec);
+ }
+ else
+ puts("PASS");
+
+ fputs("ppdFindNextAttr(wildcard): ", stdout);
+ if ((attr = ppdFindNextAttr(ppd, "cupsTest", NULL)) == NULL)
+ {
+ status ++;
+ puts("FAIL (not found)");
+ }
+ else if (strcmp(attr->name, "cupsTest") || strcmp(attr->spec, "Bar"))
+ {
+ status ++;
+ printf("FAIL (got \"%s %s\")\n", attr->name, attr->spec);
+ }
+ else
+ puts("PASS");
+
+ fputs("ppdFindAttr(Foo): ", stdout);
+ if ((attr = ppdFindAttr(ppd, "cupsTest", "Foo")) == NULL)
+ {
+ status ++;
+ puts("FAIL (not found)");
+ }
+ else if (strcmp(attr->name, "cupsTest") || strcmp(attr->spec, "Foo"))
+ {
+ status ++;
+ printf("FAIL (got \"%s %s\")\n", attr->name, attr->spec);
+ }
+ else
+ puts("PASS");
+
+ fputs("ppdFindNextAttr(Foo): ", stdout);
+ if ((attr = ppdFindNextAttr(ppd, "cupsTest", "Foo")) != NULL)
+ {
+ status ++;
+ printf("FAIL (got \"%s %s\")\n", attr->name, attr->spec);
+ }
+ else
+ puts("PASS");
+
fputs("ppdMarkDefaults: ", stdout);
ppdMarkDefaults(ppd);
DATAFILES = \
HPGLprolog \
psglyphs \
- testprint.ps
+ testprint
PPDCFILES = \
epson.h \
#CUPS-BANNER
-# While this file has a .ps extension, it is really just a special banner
-# page - we are retaining the original filename for backwards-compatibility.
Show printer-name printer-info printer-location printer-make-and-model printer-driver-name printer-driver-version paper-size imageable-area
Header Printer Test Page
Footer Printer Test Page
num_rows = cupsImageGetHeight(image);
line = malloc(depth * num_cols + 3);
temp_width = num_cols * images_height / num_rows;
- out_offset = 0;
printf("gsave %.1f %.1f translate %.3f %.3f scale\n", x, y,
temp_width / num_cols, images_height / num_rows);
d 0755 root sys $DATADIR/data -
f 0644 root sys $DATADIR/data/HPGLprolog data/HPGLprolog
f 0644 root sys $DATADIR/data/psglyphs data/psglyphs
-f 0644 root sys $DATADIR/data/testprint.ps data/testprint.ps
+f 0644 root sys $DATADIR/data/testprint data/testprint
d 0755 root sys $DATADIR/drv -
f 0644 root sys $DATADIR/drv/sample.drv ppdc/sample.drv