MCPcopy Create free account
hub / github.com/OpenPrinting/cups / ppdFindAttr

Function ppdFindAttr

cups/ppd-attr.c:27–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25 */
26
27ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
28ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
29 const char *name, /* I - Attribute name */
30 const char *spec) /* I - Specifier string or @code NULL@ */
31{
32 ppd_attr_t key, /* Search key */
33 *attr; /* Current attribute */
34
35
36 DEBUG_printf(("2ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")", ppd, name,
37 spec));
38
39 /*
40 * Range check input...
41 */
42
43 if (!ppd || !name || ppd->num_attrs == 0)
44 return (NULL);
45
46 /*
47 * Search for a matching attribute...
48 */
49
50 memset(&key, 0, sizeof(key));
51 strlcpy(key.name, name, sizeof(key.name));
52
53 /*
54 * Return the first matching attribute, if any...
55 */
56
57 if ((attr = (ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key)) != NULL)
58 {
59 if (spec)
60 {
61 /*
62 * Loop until we find the first matching attribute for "spec"...
63 */
64
65 while (attr && _cups_strcasecmp(spec, attr->spec))
66 {
67 if ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL &&
68 _cups_strcasecmp(attr->name, name))
69 attr = NULL;
70 }
71 }
72 }
73
74 return (attr);
75}
76
77
78/*

Callers 15

load_ppd_attributesFunction · 0.85
apple_register_profilesFunction · 0.85
colord_register_printerFunction · 0.85
add_printerFunction · 0.85
load_ppdFunction · 0.85
import_ppdMethod · 0.85
mainFunction · 0.85
backend_init_suppliesFunction · 0.85
mainFunction · 0.85
report_printer_stateFunction · 0.85
do_set_optionsFunction · 0.85

Calls 3

cupsArrayFindFunction · 0.85
_cups_strcasecmpFunction · 0.85
cupsArrayNextFunction · 0.85

Tested by 6

mainFunction · 0.68
check_constraintsFunction · 0.68
check_filtersFunction · 0.68
check_profilesFunction · 0.68
check_translationsFunction · 0.68
mainFunction · 0.68