]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/encode.c
Merge changes from CUPS 1.4svn-r8131.
[thirdparty/cups.git] / cups / encode.c
CommitLineData
ef416fc2 1/*
75bd9771 2 * "$Id: encode.c 7696 2008-06-26 00:54:42Z mike $"
ef416fc2 3 *
4 * Option encoding routines for the Common UNIX Printing System (CUPS).
5 *
568fa3fa 6 * Copyright 2007-2008 by Apple Inc.
b86bc4cf 7 * Copyright 1997-2007 by Easy Software Products.
ef416fc2 8 *
9 * These coded instructions, statements, and computer programs are the
bc44d920 10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
ef416fc2 14 *
15 * This file is subject to the Apple OS-Developed Software exception.
16 *
17 * Contents:
18 *
fa73b229 19 * cupsEncodeOptions() - Encode printer options into IPP attributes.
20 * cupsEncodeOptions2() - Encode printer options into IPP attributes for
21 * a group.
8ca02f3c 22 * _ippFindOption() - Find the attribute information for an option.
fa73b229 23 * compare_ipp_options() - Compare two IPP options.
ef416fc2 24 */
25
26/*
27 * Include necessary headers...
28 */
29
30#include "cups.h"
fa73b229 31#include "ipp-private.h"
ef416fc2 32#include <stdlib.h>
33#include <ctype.h>
34#include "string.h"
35#include "debug.h"
36
37
38/*
39 * Local list of option names and the value tags they should use...
fa73b229 40 *
41 * **** THIS LIST MUST BE SORTED ****
ef416fc2 42 */
43
ef416fc2 44static const _ipp_option_t ipp_options[] =
45{
5a738aea
MS
46 { 1, "auth-info", IPP_TAG_TEXT, IPP_TAG_JOB },
47 { 1, "auth-info-required", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
48 { 0, "blackplot", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
49 { 0, "blackplot-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
50 { 0, "brightness", IPP_TAG_INTEGER, IPP_TAG_JOB },
51 { 0, "brightness-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
52 { 0, "columns", IPP_TAG_INTEGER, IPP_TAG_JOB },
53 { 0, "columns-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
4b3f67ff 54 { 0, "compression", IPP_TAG_KEYWORD, IPP_TAG_OPERATION },
5a738aea
MS
55 { 0, "copies", IPP_TAG_INTEGER, IPP_TAG_JOB },
56 { 0, "copies-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
57 { 0, "document-format", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
58 { 0, "document-format-default", IPP_TAG_MIMETYPE, IPP_TAG_PRINTER },
ae71f5de 59 { 1, "exclude-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION },
5a738aea
MS
60 { 1, "finishings", IPP_TAG_ENUM, IPP_TAG_JOB },
61 { 1, "finishings-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
62 { 0, "fitplot", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
63 { 0, "fitplot-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
64 { 0, "gamma", IPP_TAG_INTEGER, IPP_TAG_JOB },
65 { 0, "gamma-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
66 { 0, "hue", IPP_TAG_INTEGER, IPP_TAG_JOB },
67 { 0, "hue-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
75bd9771 68 { 0, "job-impressions", IPP_TAG_INTEGER, IPP_TAG_JOB },
5a738aea
MS
69 { 0, "job-k-limit", IPP_TAG_INTEGER, IPP_TAG_JOB },
70 { 0, "job-page-limit", IPP_TAG_INTEGER, IPP_TAG_JOB },
71 { 0, "job-priority", IPP_TAG_INTEGER, IPP_TAG_JOB },
72 { 0, "job-quota-period", IPP_TAG_INTEGER, IPP_TAG_JOB },
568fa3fa
MS
73 { 1, "job-sheets", IPP_TAG_NAME, IPP_TAG_JOB },
74 { 1, "job-sheets-default", IPP_TAG_NAME, IPP_TAG_PRINTER },
5a738aea
MS
75 { 0, "job-uuid", IPP_TAG_URI, IPP_TAG_JOB },
76 { 0, "landscape", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
77 { 1, "media", IPP_TAG_KEYWORD, IPP_TAG_JOB },
78 { 0, "mirror", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
79 { 0, "mirror-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
80 { 0, "natural-scaling", IPP_TAG_INTEGER, IPP_TAG_JOB },
81 { 0, "natural-scaling-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
82 { 0, "notify-charset", IPP_TAG_CHARSET, IPP_TAG_SUBSCRIPTION },
83 { 1, "notify-events", IPP_TAG_KEYWORD, IPP_TAG_SUBSCRIPTION },
84 { 1, "notify-events-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
85 { 0, "notify-lease-duration", IPP_TAG_INTEGER, IPP_TAG_SUBSCRIPTION },
86 { 0, "notify-lease-duration-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
87 { 0, "notify-natural-language", IPP_TAG_LANGUAGE, IPP_TAG_SUBSCRIPTION },
88 { 0, "notify-pull-method", IPP_TAG_KEYWORD, IPP_TAG_SUBSCRIPTION },
89 { 0, "notify-recipient-uri", IPP_TAG_URI, IPP_TAG_SUBSCRIPTION },
90 { 0, "notify-time-interval", IPP_TAG_INTEGER, IPP_TAG_SUBSCRIPTION },
91 { 0, "notify-user-data", IPP_TAG_STRING, IPP_TAG_SUBSCRIPTION },
92 { 0, "number-up", IPP_TAG_INTEGER, IPP_TAG_JOB },
93 { 0, "number-up-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
94 { 0, "orientation-requested", IPP_TAG_ENUM, IPP_TAG_JOB },
95 { 0, "orientation-requested-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
96 { 0, "page-bottom", IPP_TAG_INTEGER, IPP_TAG_JOB },
97 { 0, "page-bottom-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
98 { 0, "page-left", IPP_TAG_INTEGER, IPP_TAG_JOB },
99 { 0, "page-left-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
100 { 1, "page-ranges", IPP_TAG_RANGE, IPP_TAG_JOB },
101 { 1, "page-ranges-default", IPP_TAG_RANGE, IPP_TAG_PRINTER },
102 { 0, "page-right", IPP_TAG_INTEGER, IPP_TAG_JOB },
103 { 0, "page-right-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
104 { 0, "page-top", IPP_TAG_INTEGER, IPP_TAG_JOB },
105 { 0, "page-top-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
106 { 0, "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
107 { 0, "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
108 { 0, "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER },
109 { 0, "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
110 { 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
111 { 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
112 { 0, "prettyprint-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
113 { 0, "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB },
114 { 0, "print-quality-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
115 { 0, "printer-error-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
116 { 0, "printer-info", IPP_TAG_TEXT, IPP_TAG_PRINTER },
117 { 0, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
118 { 0, "printer-is-shared", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
119 { 0, "printer-location", IPP_TAG_TEXT, IPP_TAG_PRINTER },
120 { 0, "printer-make-and-model", IPP_TAG_TEXT, IPP_TAG_PRINTER },
121 { 0, "printer-more-info", IPP_TAG_URI, IPP_TAG_PRINTER },
122 { 0, "printer-op-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
123 { 0, "printer-resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB },
124 { 0, "printer-state", IPP_TAG_ENUM, IPP_TAG_PRINTER },
125 { 0, "printer-state-change-time", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
126 { 1, "printer-state-reasons", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
127 { 0, "printer-type", IPP_TAG_ENUM, IPP_TAG_PRINTER },
128 { 0, "printer-uri", IPP_TAG_URI, IPP_TAG_OPERATION },
129 { 0, "queued-job-count", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
130 { 0, "raw", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
ae71f5de 131 { 1, "requested-attributes", IPP_TAG_NAME, IPP_TAG_OPERATION },
5a738aea
MS
132 { 1, "requesting-user-name-allowed", IPP_TAG_NAME, IPP_TAG_PRINTER },
133 { 1, "requesting-user-name-denied", IPP_TAG_NAME, IPP_TAG_PRINTER },
134 { 0, "resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB },
135 { 0, "resolution-default", IPP_TAG_RESOLUTION, IPP_TAG_PRINTER },
136 { 0, "saturation", IPP_TAG_INTEGER, IPP_TAG_JOB },
137 { 0, "saturation-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
138 { 0, "scaling", IPP_TAG_INTEGER, IPP_TAG_JOB },
139 { 0, "scaling-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
140 { 0, "sides", IPP_TAG_KEYWORD, IPP_TAG_JOB },
141 { 0, "sides-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
142 { 0, "wrap", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
143 { 0, "wrap-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER }
ef416fc2 144};
145
146
fa73b229 147/*
148 * Local functions...
149 */
150
151static int compare_ipp_options(_ipp_option_t *a, _ipp_option_t *b);
152
153
ef416fc2 154/*
155 * 'cupsEncodeOptions()' - Encode printer options into IPP attributes.
156 *
157 * This function adds operation, job, and then subscription attributes,
158 * in that order. Use the cupsEncodeOptions2() function to add attributes
159 * for a single group.
160 */
161
162void
163cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
164 int num_options, /* I - Number of options */
165 cups_option_t *options) /* I - Options */
166{
167 DEBUG_printf(("cupsEncodeOptions(%p, %d, %p)\n", ipp, num_options, options));
168
169 /*
170 * Add the options in the proper groups & order...
171 */
172
173 cupsEncodeOptions2(ipp, num_options, options, IPP_TAG_OPERATION);
174 cupsEncodeOptions2(ipp, num_options, options, IPP_TAG_JOB);
175 cupsEncodeOptions2(ipp, num_options, options, IPP_TAG_SUBSCRIPTION);
176}
177
178
179/*
180 * 'cupsEncodeOptions2()' - Encode printer options into IPP attributes for a group.
181 *
182 * This function only adds attributes for a single group. Call this
183 * function multiple times for each group, or use cupsEncodeOptions()
184 * to add the standard groups.
185 *
186 * @since CUPS 1.2@
187 */
188
189void
190cupsEncodeOptions2(
191 ipp_t *ipp, /* I - Request to add to */
192 int num_options, /* I - Number of options */
193 cups_option_t *options, /* I - Options */
194 ipp_tag_t group_tag) /* I - Group to encode */
195{
196 int i, j; /* Looping vars */
197 int count; /* Number of values */
198 char *s, /* Pointer into option value */
199 *val, /* Pointer to option value */
200 *copy, /* Copy of option value */
5a738aea
MS
201 *sep, /* Option separator */
202 quote; /* Quote character */
ef416fc2 203 ipp_attribute_t *attr; /* IPP attribute */
204 ipp_tag_t value_tag; /* IPP value tag */
b423cd4c 205 cups_option_t *option; /* Current option */
ef416fc2 206
207
b423cd4c 208 DEBUG_printf(("cupsEncodeOptions2(ipp=%p, num_options=%d, options=%p, "
209 "group_tag=%x)\n", ipp, num_options, options, group_tag));
ef416fc2 210
211 /*
212 * Range check input...
213 */
214
b423cd4c 215 if (!ipp || num_options < 1 || !options)
ef416fc2 216 return;
217
218 /*
219 * Do special handling for the document-format/raw options...
220 */
221
222 if (group_tag == IPP_TAG_OPERATION)
223 {
224 /*
225 * Handle the document format stuff first...
226 */
227
228 if ((val = (char *)cupsGetOption("document-format", num_options, options)) != NULL)
229 ippAddString(ipp, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
230 NULL, val);
231 else if (cupsGetOption("raw", num_options, options))
232 ippAddString(ipp, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
233 NULL, "application/vnd.cups-raw");
234 else
235 ippAddString(ipp, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
236 NULL, "application/octet-stream");
237 }
238
239 /*
240 * Then loop through the options...
241 */
242
b423cd4c 243 for (i = num_options, option = options; i > 0; i --, option ++)
ef416fc2 244 {
8ca02f3c 245 _ipp_option_t *match; /* Matching attribute */
fa73b229 246
247
ef416fc2 248 /*
249 * Skip document format options that are handled above...
250 */
251
b423cd4c 252 if (!strcasecmp(option->name, "raw") ||
253 !strcasecmp(option->name, "document-format") ||
254 !option->name[0])
ef416fc2 255 continue;
256
257 /*
258 * Figure out the proper value and group tags for this option...
259 */
260
8ca02f3c 261 if ((match = _ippFindOption(option->name)) != NULL)
ef416fc2 262 {
fa73b229 263 if (match->group_tag != group_tag)
ef416fc2 264 continue;
265
fa73b229 266 value_tag = match->value_tag;
ef416fc2 267 }
ef416fc2 268 else
b423cd4c 269 {
270 int namelen; /* Length of name */
271
272
b86bc4cf 273 namelen = (int)strlen(option->name);
b423cd4c 274
275 if (namelen < 9 || strcmp(option->name + namelen - 8, "-default"))
276 {
277 if (group_tag != IPP_TAG_JOB)
278 continue;
279 }
280 else if (group_tag != IPP_TAG_PRINTER)
281 continue;
282
283 if (!strcasecmp(option->value, "true") ||
284 !strcasecmp(option->value, "false"))
285 value_tag = IPP_TAG_BOOLEAN;
286 else
287 value_tag = IPP_TAG_NAME;
288 }
ef416fc2 289
290 /*
291 * Count the number of values...
292 */
293
5a738aea 294 if (match && match->multivalue)
ef416fc2 295 {
5a738aea 296 for (count = 1, sep = option->value, quote = 0; *sep; sep ++)
ef416fc2 297 {
5a738aea
MS
298 if (*sep == quote)
299 quote = 0;
300 else if (!quote && (*sep == '\'' || *sep == '\"'))
301 {
302 /*
303 * Skip quoted option value...
304 */
ef416fc2 305
5a738aea
MS
306 quote = *sep++;
307 }
308 else if (*sep == ',' && !quote)
309 count ++;
310 else if (*sep == '\\' && sep[1])
ef416fc2 311 sep ++;
ef416fc2 312 }
ef416fc2 313 }
5a738aea
MS
314 else
315 count = 1;
ef416fc2 316
317 DEBUG_printf(("cupsEncodeOptions2: option = \'%s\', count = %d\n",
b423cd4c 318 option->name, count));
ef416fc2 319
320 /*
321 * Allocate memory for the attribute values...
322 */
323
757d2cad 324 if ((attr = _ippAddAttr(ipp, count)) == NULL)
ef416fc2 325 {
326 /*
327 * Ran out of memory!
328 */
329
330 DEBUG_puts("cupsEncodeOptions2: Ran out of memory for attributes!");
331 return;
332 }
333
334 /*
335 * Now figure out what type of value we have...
336 */
337
338 attr->group_tag = group_tag;
339 attr->value_tag = value_tag;
340
341 /*
342 * Copy the name over...
343 */
344
e53920b9 345 if ((attr->name = _cupsStrAlloc(option->name)) == NULL)
ef416fc2 346 {
347 /*
348 * Ran out of memory!
349 */
350
351 DEBUG_puts("cupsEncodeOptions2: Ran out of memory for name!");
352 return;
353 }
354
355 if (count > 1)
356 {
357 /*
358 * Make a copy of the value we can fiddle with...
359 */
360
b423cd4c 361 if ((copy = strdup(option->value)) == NULL)
ef416fc2 362 {
363 /*
364 * Ran out of memory!
365 */
366
367 DEBUG_puts("cupsEncodeOptions2: Ran out of memory for value copy!");
368 return;
369 }
370
371 val = copy;
372 }
373 else
374 {
375 /*
376 * Since we have a single value, use the value directly...
377 */
378
b423cd4c 379 val = option->value;
ef416fc2 380 copy = NULL;
381 }
382
383 /*
384 * Scan the value string for values...
385 */
386
5a738aea 387 for (j = 0, sep = val; j < count; val = sep, j ++)
ef416fc2 388 {
389 /*
390 * Find the end of this value and mark it if needed...
391 */
392
5a738aea 393 if (count > 1)
91c84a35 394 {
5a738aea 395 for (quote = 0; *sep; sep ++)
91c84a35 396 {
5a738aea
MS
397 if (*sep == quote)
398 {
399 /*
400 * Finish quoted value...
401 */
91c84a35 402
5a738aea
MS
403 quote = 0;
404 }
405 else if (!quote && (*sep == '\'' || *sep == '\"'))
406 {
407 /*
408 * Handle quoted option value...
409 */
91c84a35 410
5a738aea
MS
411 quote = *sep;
412 }
413 else if (*sep == ',' && count > 1)
414 break;
415 else if (*sep == '\\' && sep[1])
416 {
417 /*
418 * Skip quoted character...
419 */
91c84a35 420
91c84a35 421 sep ++;
5a738aea 422 }
91c84a35 423 }
91c84a35 424
5a738aea
MS
425 if (*sep == ',')
426 *sep++ = '\0';
427 }
ef416fc2 428
429 /*
430 * Copy the option value(s) over as needed by the type...
431 */
432
433 switch (attr->value_tag)
434 {
435 case IPP_TAG_INTEGER :
436 case IPP_TAG_ENUM :
437 /*
438 * Integer/enumeration value...
439 */
440
5a738aea 441 attr->values[j].integer = strtol(val, &s, 10);
ef416fc2 442
443 DEBUG_printf(("cupsEncodeOptions2: Added integer option value %d...\n",
444 attr->values[j].integer));
445 break;
446
447 case IPP_TAG_BOOLEAN :
448 if (!strcasecmp(val, "true") ||
449 !strcasecmp(val, "on") ||
450 !strcasecmp(val, "yes"))
451 {
452 /*
453 * Boolean value - true...
454 */
455
456 attr->values[j].boolean = 1;
457
458 DEBUG_puts("cupsEncodeOptions2: Added boolean true value...");
459 }
460 else
461 {
462 /*
463 * Boolean value - false...
464 */
465
466 attr->values[j].boolean = 0;
467
468 DEBUG_puts("cupsEncodeOptions2: Added boolean false value...");
469 }
470 break;
471
472 case IPP_TAG_RANGE :
473 /*
474 * Range...
475 */
476
477 if (*val == '-')
478 {
479 attr->values[j].range.lower = 1;
480 s = val;
481 }
482 else
5a738aea 483 attr->values[j].range.lower = strtol(val, &s, 10);
ef416fc2 484
485 if (*s == '-')
486 {
487 if (s[1])
5a738aea 488 attr->values[j].range.upper = strtol(s + 1, NULL, 10);
ef416fc2 489 else
490 attr->values[j].range.upper = 2147483647;
491 }
492 else
493 attr->values[j].range.upper = attr->values[j].range.lower;
494
495 DEBUG_printf(("cupsEncodeOptions2: Added range option value %d-%d...\n",
496 attr->values[j].range.lower,
497 attr->values[j].range.upper));
498 break;
499
500 case IPP_TAG_RESOLUTION :
501 /*
502 * Resolution...
503 */
504
5a738aea 505 attr->values[j].resolution.xres = strtol(val, &s, 10);
ef416fc2 506
507 if (*s == 'x')
5a738aea 508 attr->values[j].resolution.yres = strtol(s + 1, &s, 10);
ef416fc2 509 else
510 attr->values[j].resolution.yres = attr->values[j].resolution.xres;
511
b423cd4c 512 if (!strcasecmp(s, "dpc"))
ef416fc2 513 attr->values[j].resolution.units = IPP_RES_PER_CM;
514 else
515 attr->values[j].resolution.units = IPP_RES_PER_INCH;
516
517 DEBUG_printf(("cupsEncodeOptions2: Added resolution option value %s...\n",
518 val));
519 break;
520
521 case IPP_TAG_STRING :
522 /*
523 * octet-string
524 */
525
b86bc4cf 526 attr->values[j].unknown.length = (int)strlen(val);
5a738aea 527 attr->values[j].unknown.data = strdup(val);
ef416fc2 528
ae71f5de
MS
529 DEBUG_printf(("cupsEncodeOptions2: Added octet-string value "
530 "\"%s\"...\n", (char *)attr->values[j].unknown.data));
ef416fc2 531 break;
532
533 default :
e53920b9 534 if ((attr->values[j].string.text = _cupsStrAlloc(val)) == NULL)
ef416fc2 535 {
536 /*
537 * Ran out of memory!
538 */
539
540 DEBUG_puts("cupsEncodeOptions2: Ran out of memory for string!");
541 return;
542 }
543
544 DEBUG_printf(("cupsEncodeOptions2: Added string value \"%s\"...\n",
545 val));
546 break;
547 }
548 }
e53920b9 549
550 if (copy)
551 free(copy);
ef416fc2 552 }
553}
554
555
8ca02f3c 556/*
557 * '_ippFindOption()' - Find the attribute information for an option.
558 */
559
560_ipp_option_t * /* O - Attribute information */
561_ippFindOption(const char *name) /* I - Option/attribute name */
562{
563 _ipp_option_t key; /* Search key */
564
565
566 /*
567 * Lookup the proper value and group tags for this option...
568 */
569
570 key.name = name;
571
572 return ((_ipp_option_t *)bsearch(&key, ipp_options,
573 sizeof(ipp_options) / sizeof(ipp_options[0]),
574 sizeof(ipp_options[0]),
575 (int (*)(const void *, const void *))
576 compare_ipp_options));
577}
578
579
ef416fc2 580/*
fa73b229 581 * 'compare_ipp_options()' - Compare two IPP options.
582 */
583
584static int /* O - Result of comparison */
585compare_ipp_options(_ipp_option_t *a, /* I - First option */
586 _ipp_option_t *b) /* I - Second option */
587{
588 return (strcmp(a->name, b->name));
589}
590
591
592/*
75bd9771 593 * End of "$Id: encode.c 7696 2008-06-26 00:54:42Z mike $".
ef416fc2 594 */