]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/mark.c
2 * "$Id: mark.c 7757 2008-07-18 16:43:43Z mike $"
4 * Option marking routines for the Common UNIX Printing System (CUPS).
6 * Copyright 2007-2008 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
9 * These coded instructions, statements, and computer programs are the
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/".
15 * PostScript is a trademark of Adobe Systems, Inc.
17 * This file is subject to the Apple OS-Developed Software exception.
21 * cupsMarkOptions() - Mark command-line options in a PPD file.
22 * ppdFindChoice() - Return a pointer to an option choice.
23 * ppdFindMarkedChoice() - Return the marked choice for the specified option.
24 * ppdFindOption() - Return a pointer to the specified option.
25 * ppdIsMarked() - Check to see if an option is marked.
26 * ppdMarkDefaults() - Mark all default options in the PPD file.
27 * ppdMarkOption() - Mark an option in a PPD file and return the number
29 * ppdFirstOption() - Return the first option in the PPD file.
30 * ppdNextOption() - Return the next option in the PPD file.
31 * _ppdParseOptions() - Parse options from a PPD file.
32 * debug_marked() - Output the marked array to stdout...
33 * ppd_defaults() - Set the defaults for this group and all sub-groups.
34 * ppd_mark_choices() - Mark one or more option choices from a string.
35 * ppd_mark_option() - Quick mark an option without checking for
40 * Include necessary headers...
53 static void debug_marked(ppd_file_t
*ppd
, const char *title
);
55 # define debug_marked(ppd,title)
57 static void ppd_defaults(ppd_file_t
*ppd
, ppd_group_t
*g
);
58 static void ppd_mark_choices(ppd_file_t
*ppd
, const char *s
);
59 static void ppd_mark_option(ppd_file_t
*ppd
, const char *option
,
64 * 'cupsMarkOptions()' - Mark command-line options in a PPD file.
66 * This function maps the IPP "finishings", "media", "mirror",
67 * "multiple-document-handling", "output-bin", "printer-resolution", and
68 * "sides" attributes to their corresponding PPD options and choices.
71 int /* O - 1 if conflicts exist, 0 otherwise */
73 ppd_file_t
*ppd
, /* I - PPD file */
74 int num_options
, /* I - Number of options */
75 cups_option_t
*options
) /* I - Options */
77 int i
, j
, k
; /* Looping vars */
78 char *val
, /* Pointer into value */
79 *ptr
, /* Pointer into string */
80 s
[255]; /* Temporary string */
81 const char *page_size
; /* PageSize option */
82 cups_option_t
*optptr
; /* Current option */
83 ppd_option_t
*option
; /* PPD option */
84 ppd_attr_t
*attr
; /* PPD attribute */
85 static const char * const duplex_options
[] =
86 { /* Duplex option names */
89 "EFDuplexing", /* EFI */
90 "KD03Duplex", /* Kodak */
91 "JCLDuplex" /* Samsung */
93 static const char * const duplex_one
[] =
94 { /* one-sided names */
98 static const char * const duplex_two_long
[] =
99 { /* two-sided-long-edge names */
100 "DuplexNoTumble", /* Adobe */
101 "LongEdge", /* EFI */
104 static const char * const duplex_two_short
[] =
105 { /* two-sided-long-edge names */
106 "DuplexTumble", /* Adobe */
107 "ShortEdge", /* EFI */
116 if (!ppd
|| num_options
<= 0 || !options
)
119 debug_marked(ppd
, "Before...");
125 for (i
= num_options
, optptr
= options
; i
> 0; i
--, optptr
++)
126 if (!strcasecmp(optptr
->name
, "media"))
129 * Loop through the option string, separating it at commas and
130 * marking each individual option as long as the corresponding
131 * PPD option (PageSize, InputSlot, etc.) is not also set.
133 * For PageSize, we also check for an empty option value since
134 * some versions of MacOS X use it to specify auto-selection
135 * of the media based solely on the size.
138 page_size
= cupsGetOption("PageSize", num_options
, options
);
140 for (val
= optptr
->value
; *val
;)
143 * Extract the sub-option from the string...
146 for (ptr
= s
; *val
&& *val
!= ',' && (ptr
- s
) < (sizeof(s
) - 1);)
157 if (!page_size
|| !page_size
[0])
158 ppd_mark_option(ppd
, "PageSize", s
);
160 if (cupsGetOption("InputSlot", num_options
, options
) == NULL
)
161 ppd_mark_option(ppd
, "InputSlot", s
);
163 if (cupsGetOption("MediaType", num_options
, options
) == NULL
)
164 ppd_mark_option(ppd
, "MediaType", s
);
166 if (cupsGetOption("EFMediaType", num_options
, options
) == NULL
)
167 ppd_mark_option(ppd
, "EFMediaType", s
); /* EFI */
169 if (cupsGetOption("EFMediaQualityMode", num_options
, options
) == NULL
)
170 ppd_mark_option(ppd
, "EFMediaQualityMode", s
); /* EFI */
172 if (!strcasecmp(s
, "manual") &&
173 !cupsGetOption("ManualFeed", num_options
, options
))
174 ppd_mark_option(ppd
, "ManualFeed", "True");
177 else if (!strcasecmp(optptr
->name
, "sides"))
180 j
< (int)(sizeof(duplex_options
) / sizeof(duplex_options
[0]));
182 if (cupsGetOption(duplex_options
[j
], num_options
, options
))
185 if (j
< (int)(sizeof(duplex_options
) / sizeof(duplex_options
[0])))
188 * Don't override the PPD option with the IPP attribute...
194 if (!strcasecmp(optptr
->value
, "one-sided"))
197 * Mark the appropriate duplex option for one-sided output...
201 j
< (int)(sizeof(duplex_options
) / sizeof(duplex_options
[0]));
203 if ((option
= ppdFindOption(ppd
, duplex_options
[j
])) != NULL
)
206 if (j
< (int)(sizeof(duplex_options
) / sizeof(duplex_options
[0])))
209 k
< (int)(sizeof(duplex_one
) / sizeof(duplex_one
[0]));
211 if (ppdFindChoice(option
, duplex_one
[k
]))
213 ppd_mark_option(ppd
, duplex_options
[j
], duplex_one
[k
]);
218 else if (!strcasecmp(optptr
->value
, "two-sided-long-edge"))
221 * Mark the appropriate duplex option for two-sided-long-edge output...
225 j
< (int)(sizeof(duplex_options
) / sizeof(duplex_options
[0]));
227 if ((option
= ppdFindOption(ppd
, duplex_options
[j
])) != NULL
)
230 if (j
< (int)(sizeof(duplex_options
) / sizeof(duplex_options
[0])))
233 k
< (int)(sizeof(duplex_two_long
) / sizeof(duplex_two_long
[0]));
235 if (ppdFindChoice(option
, duplex_two_long
[k
]))
237 ppd_mark_option(ppd
, duplex_options
[j
], duplex_two_long
[k
]);
242 else if (!strcasecmp(optptr
->value
, "two-sided-short-edge"))
245 * Mark the appropriate duplex option for two-sided-short-edge output...
249 j
< (int)(sizeof(duplex_options
) / sizeof(duplex_options
[0]));
251 if ((option
= ppdFindOption(ppd
, duplex_options
[j
])) != NULL
)
254 if (j
< (int)(sizeof(duplex_options
) / sizeof(duplex_options
[0])))
257 k
< (int)(sizeof(duplex_two_short
) / sizeof(duplex_two_short
[0]));
259 if (ppdFindChoice(option
, duplex_two_short
[k
]))
261 ppd_mark_option(ppd
, duplex_options
[j
], duplex_two_short
[k
]);
267 else if (!strcasecmp(optptr
->name
, "resolution") ||
268 !strcasecmp(optptr
->name
, "printer-resolution"))
270 ppd_mark_option(ppd
, "Resolution", optptr
->value
);
271 ppd_mark_option(ppd
, "SetResolution", optptr
->value
);
272 /* Calcomp, Linotype, QMS, Summagraphics, Tektronix, Varityper */
273 ppd_mark_option(ppd
, "JCLResolution", optptr
->value
);
275 ppd_mark_option(ppd
, "CNRes_PGP", optptr
->value
);
278 else if (!strcasecmp(optptr
->name
, "output-bin"))
280 if (!cupsGetOption("OutputBin", num_options
, options
))
281 ppd_mark_option(ppd
, "OutputBin", optptr
->value
);
283 else if (!strcasecmp(optptr
->name
, "multiple-document-handling"))
285 if (!cupsGetOption("Collate", num_options
, options
) &&
286 ppdFindOption(ppd
, "Collate"))
288 if (strcasecmp(optptr
->value
, "separate-documents-uncollated-copies"))
289 ppd_mark_option(ppd
, "Collate", "True");
291 ppd_mark_option(ppd
, "Collate", "False");
294 else if (!strcasecmp(optptr
->name
, "finishings"))
297 * Lookup cupsIPPFinishings attributes for each value...
300 for (ptr
= optptr
->value
; *ptr
;)
303 * Get the next finishings number...
306 if (!isdigit(*ptr
& 255))
309 if ((j
= strtol(ptr
, &ptr
, 10)) < 3)
313 * Skip separator as needed...
320 * Look it up in the PPD file...
325 if ((attr
= ppdFindAttr(ppd
, "cupsIPPFinishings", s
)) == NULL
)
329 * Apply "*Option Choice" settings from the attribute value...
332 ppd_mark_choices(ppd
, attr
->value
);
335 else if (!strcasecmp(optptr
->name
, "APPrinterPreset"))
338 * Lookup APPrinterPreset value...
341 if ((attr
= ppdFindAttr(ppd
, "APPrinterPreset", optptr
->value
)) != NULL
)
344 * Apply "*Option Choice" settings from the attribute value...
347 ppd_mark_choices(ppd
, attr
->value
);
350 else if (!strcasecmp(optptr
->name
, "mirror"))
351 ppd_mark_option(ppd
, "MirrorPrint", optptr
->value
);
353 ppd_mark_option(ppd
, optptr
->name
, optptr
->value
);
355 debug_marked(ppd
, "After...");
357 return (ppdConflicts(ppd
) > 0);
362 * 'ppdFindChoice()' - Return a pointer to an option choice.
365 ppd_choice_t
* /* O - Choice pointer or @code NULL@ */
366 ppdFindChoice(ppd_option_t
*o
, /* I - Pointer to option */
367 const char *choice
) /* I - Name of choice */
369 int i
; /* Looping var */
370 ppd_choice_t
*c
; /* Current choice */
376 if (choice
[0] == '{' || !strncasecmp(choice
, "Custom.", 7))
379 for (i
= o
->num_choices
, c
= o
->choices
; i
> 0; i
--, c
++)
380 if (!strcasecmp(c
->choice
, choice
))
388 * 'ppdFindMarkedChoice()' - Return the marked choice for the specified option.
391 ppd_choice_t
* /* O - Pointer to choice or @code NULL@ */
392 ppdFindMarkedChoice(ppd_file_t
*ppd
, /* I - PPD file */
393 const char *option
) /* I - Keyword/option name */
395 ppd_choice_t key
; /* Search key for choice */
398 if ((key
.option
= ppdFindOption(ppd
, option
)) == NULL
)
401 return ((ppd_choice_t
*)cupsArrayFind(ppd
->marked
, &key
));
406 * 'ppdFindOption()' - Return a pointer to the specified option.
409 ppd_option_t
* /* O - Pointer to option or @code NULL@ */
410 ppdFindOption(ppd_file_t
*ppd
, /* I - PPD file data */
411 const char *option
) /* I - Option/Keyword name */
414 * Range check input...
423 * Search in the array...
426 ppd_option_t key
; /* Option search key */
429 strlcpy(key
.keyword
, option
, sizeof(key
.keyword
));
431 return ((ppd_option_t
*)cupsArrayFind(ppd
->options
, &key
));
436 * Search in each group...
439 int i
, j
; /* Looping vars */
440 ppd_group_t
*group
; /* Current group */
441 ppd_option_t
*optptr
; /* Current option */
444 for (i
= ppd
->num_groups
, group
= ppd
->groups
; i
> 0; i
--, group
++)
445 for (j
= group
->num_options
, optptr
= group
->options
;
448 if (!strcasecmp(optptr
->keyword
, option
))
457 * 'ppdIsMarked()' - Check to see if an option is marked.
460 int /* O - Non-zero if option is marked */
461 ppdIsMarked(ppd_file_t
*ppd
, /* I - PPD file data */
462 const char *option
, /* I - Option/Keyword name */
463 const char *choice
) /* I - Choice name */
465 ppd_choice_t key
, /* Search key */
466 *c
; /* Choice pointer */
472 if ((key
.option
= ppdFindOption(ppd
, option
)) == NULL
)
475 if ((c
= (ppd_choice_t
*)cupsArrayFind(ppd
->marked
, &key
)) == NULL
)
478 return (!strcmp(c
->choice
, choice
));
483 * 'ppdMarkDefaults()' - Mark all default options in the PPD file.
487 ppdMarkDefaults(ppd_file_t
*ppd
) /* I - PPD file record */
489 int i
; /* Looping variables */
490 ppd_group_t
*g
; /* Current group */
491 ppd_choice_t
*c
; /* Current choice */
498 * Clean out the marked array...
501 for (c
= (ppd_choice_t
*)cupsArrayFirst(ppd
->marked
);
503 c
= (ppd_choice_t
*)cupsArrayNext(ppd
->marked
))
504 cupsArrayRemove(ppd
->marked
, c
);
507 * Then repopulate it with the defaults...
510 for (i
= ppd
->num_groups
, g
= ppd
->groups
; i
> 0; i
--, g
++)
511 ppd_defaults(ppd
, g
);
516 * 'ppdMarkOption()' - Mark an option in a PPD file and return the number of
520 int /* O - Number of conflicts */
521 ppdMarkOption(ppd_file_t
*ppd
, /* I - PPD file record */
522 const char *option
, /* I - Keyword */
523 const char *choice
) /* I - Option name */
525 DEBUG_printf(("ppdMarkOption(ppd=%p, option=\"%s\", choice=\"%s\")\n",
526 ppd
, option
, choice
));
529 * Range check input...
532 if (!ppd
|| !option
|| !choice
)
539 ppd_mark_option(ppd
, option
, choice
);
542 * Return the number of conflicts...
545 return (ppdConflicts(ppd
));
550 * 'ppdFirstOption()' - Return the first option in the PPD file.
552 * Options are returned from all groups in ascending alphanumeric order.
557 ppd_option_t
* /* O - First option or @code NULL@ */
558 ppdFirstOption(ppd_file_t
*ppd
) /* I - PPD file */
563 return ((ppd_option_t
*)cupsArrayFirst(ppd
->options
));
568 * 'ppdNextOption()' - Return the next option in the PPD file.
570 * Options are returned from all groups in ascending alphanumeric order.
575 ppd_option_t
* /* O - Next option or @code NULL@ */
576 ppdNextOption(ppd_file_t
*ppd
) /* I - PPD file */
581 return ((ppd_option_t
*)cupsArrayNext(ppd
->options
));
586 * '_ppdParseOptions()' - Parse options from a PPD file.
588 * This function looks for strings of the form:
590 * *option choice ... *optionN choiceN
592 * It stops when it finds a string that doesn't match this format.
595 int /* O - Number of options */
597 const char *s
, /* I - String to parse */
598 int num_options
, /* I - Number of options */
599 cups_option_t
**options
) /* IO - Options */
601 char option
[PPD_MAX_NAME
], /* Current option */
602 choice
[PPD_MAX_NAME
], /* Current choice */
603 *ptr
; /* Pointer into option or choice */
607 return (num_options
);
610 * Read all of the "*Option Choice" pairs from the string, marking PPD
611 * options as we go...
617 * Skip leading whitespace...
620 while (isspace(*s
& 255))
627 * Get the option name...
632 while (*s
&& !isspace(*s
& 255) && ptr
< (option
+ sizeof(option
) - 1))
644 while (isspace(*s
& 255))
651 while (*s
&& !isspace(*s
& 255) && ptr
< (choice
+ sizeof(choice
) - 1))
657 * Add it to the options array...
660 num_options
= cupsAddOption(option
, choice
, num_options
, options
);
663 return (num_options
);
669 * 'debug_marked()' - Output the marked array to stdout...
673 debug_marked(ppd_file_t
*ppd
, /* I - PPD file data */
674 const char *title
) /* I - Title for list */
676 ppd_choice_t
*c
; /* Current choice */
679 DEBUG_printf(("cupsMarkOptions: %s\n", title
));
681 for (c
= (ppd_choice_t
*)cupsArrayFirst(ppd
->marked
);
683 c
= (ppd_choice_t
*)cupsArrayNext(ppd
->marked
))
684 DEBUG_printf(("cupsMarkOptions: %s=%s\n", c
->option
->keyword
, c
->choice
));
690 * 'ppd_defaults()' - Set the defaults for this group and all sub-groups.
694 ppd_defaults(ppd_file_t
*ppd
, /* I - PPD file */
695 ppd_group_t
*g
) /* I - Group to default */
697 int i
; /* Looping var */
698 ppd_option_t
*o
; /* Current option */
699 ppd_group_t
*sg
; /* Current sub-group */
702 for (i
= g
->num_options
, o
= g
->options
; i
> 0; i
--, o
++)
703 if (strcasecmp(o
->keyword
, "PageRegion") != 0)
704 ppdMarkOption(ppd
, o
->keyword
, o
->defchoice
);
706 for (i
= g
->num_subgroups
, sg
= g
->subgroups
; i
> 0; i
--, sg
++)
707 ppd_defaults(ppd
, sg
);
712 * 'ppd_mark_choices()' - Mark one or more option choices from a string.
716 ppd_mark_choices(ppd_file_t
*ppd
, /* I - PPD file */
717 const char *s
) /* I - "*Option Choice ..." string */
719 int i
, /* Looping var */
720 num_options
; /* Number of options */
721 cups_option_t
*options
, /* Options */
722 *option
; /* Current option */
729 num_options
= _ppdParseOptions(s
, 0, &options
);
731 for (i
= num_options
, option
= options
; i
> 0; i
--, option
++)
732 ppd_mark_option(ppd
, option
->name
, option
->value
);
734 cupsFreeOptions(num_options
, options
);
739 * 'ppd_mark_option()' - Quick mark an option without checking for conflicts.
743 ppd_mark_option(ppd_file_t
*ppd
, /* I - PPD file */
744 const char *option
, /* I - Option name */
745 const char *choice
) /* I - Choice name */
747 int i
, j
; /* Looping vars */
748 ppd_option_t
*o
; /* Option pointer */
749 ppd_choice_t
*c
, /* Choice pointer */
750 *oldc
, /* Old choice pointer */
751 key
; /* Search key for choice */
752 struct lconv
*loc
; /* Locale data */
755 DEBUG_printf(("ppd_mark_option(ppd=%p, option=\"%s\", choice=\"%s\")\n",
756 ppd
, option
, choice
));
759 * AP_D_InputSlot is the "default input slot" on MacOS X, and setting
760 * it clears the regular InputSlot choices...
763 if (!strcasecmp(option
, "AP_D_InputSlot"))
765 if ((o
= ppdFindOption(ppd
, "InputSlot")) != NULL
)
768 if ((oldc
= (ppd_choice_t
*)cupsArrayFind(ppd
->marked
, &key
)) != NULL
)
771 cupsArrayRemove(ppd
->marked
, oldc
);
777 * Check for custom options...
780 if ((o
= ppdFindOption(ppd
, option
)) == NULL
)
785 if (!strncasecmp(choice
, "Custom.", 7))
788 * Handle a custom option...
791 if ((c
= ppdFindChoice(o
, "Custom")) == NULL
)
794 if (!strcasecmp(option
, "PageSize"))
797 * Handle custom page sizes...
800 ppdPageSize(ppd
, choice
);
805 * Handle other custom options...
808 ppd_coption_t
*coption
; /* Custom option */
809 ppd_cparam_t
*cparam
; /* Custom parameter */
810 char *units
; /* Custom points units */
813 if ((coption
= ppdFindCustomOption(ppd
, option
)) != NULL
)
815 if ((cparam
= (ppd_cparam_t
*)cupsArrayFirst(coption
->params
)) == NULL
)
818 switch (cparam
->type
)
820 case PPD_CUSTOM_CURVE
:
821 case PPD_CUSTOM_INVCURVE
:
822 case PPD_CUSTOM_REAL
:
823 cparam
->current
.custom_real
= (float)_cupsStrScand(choice
+ 7,
827 case PPD_CUSTOM_POINTS
:
828 cparam
->current
.custom_points
= (float)_cupsStrScand(choice
+ 7,
834 if (!strcasecmp(units
, "cm"))
835 cparam
->current
.custom_points
*= 72.0f
/ 2.54f
;
836 else if (!strcasecmp(units
, "mm"))
837 cparam
->current
.custom_points
*= 72.0f
/ 25.4f
;
838 else if (!strcasecmp(units
, "m"))
839 cparam
->current
.custom_points
*= 72.0f
/ 0.0254f
;
840 else if (!strcasecmp(units
, "in"))
841 cparam
->current
.custom_points
*= 72.0f
;
842 else if (!strcasecmp(units
, "ft"))
843 cparam
->current
.custom_points
*= 12.0f
* 72.0f
;
847 case PPD_CUSTOM_INT
:
848 cparam
->current
.custom_int
= atoi(choice
+ 7);
851 case PPD_CUSTOM_PASSCODE
:
852 case PPD_CUSTOM_PASSWORD
:
853 case PPD_CUSTOM_STRING
:
854 if (cparam
->current
.custom_string
)
855 _cupsStrFree(cparam
->current
.custom_string
);
857 cparam
->current
.custom_string
= _cupsStrAlloc(choice
+ 7);
864 * Make sure that we keep the option marked below...
869 else if (choice
[0] == '{')
872 * Handle multi-value custom options...
875 ppd_coption_t
*coption
; /* Custom option */
876 ppd_cparam_t
*cparam
; /* Custom parameter */
877 char *units
; /* Custom points units */
878 int num_vals
; /* Number of values */
879 cups_option_t
*vals
, /* Values */
883 if ((c
= ppdFindChoice(o
, "Custom")) == NULL
)
886 if ((coption
= ppdFindCustomOption(ppd
, option
)) != NULL
)
888 num_vals
= cupsParseOptions(choice
, 0, &vals
);
890 for (i
= 0, val
= vals
; i
< num_vals
; i
++, val
++)
892 if ((cparam
= ppdFindCustomParam(coption
, val
->name
)) == NULL
)
895 switch (cparam
->type
)
897 case PPD_CUSTOM_CURVE
:
898 case PPD_CUSTOM_INVCURVE
:
899 case PPD_CUSTOM_REAL
:
900 cparam
->current
.custom_real
= (float)_cupsStrScand(val
->value
,
904 case PPD_CUSTOM_POINTS
:
905 cparam
->current
.custom_points
= (float)_cupsStrScand(val
->value
,
911 if (!strcasecmp(units
, "cm"))
912 cparam
->current
.custom_points
*= 72.0f
/ 2.54f
;
913 else if (!strcasecmp(units
, "mm"))
914 cparam
->current
.custom_points
*= 72.0f
/ 25.4f
;
915 else if (!strcasecmp(units
, "m"))
916 cparam
->current
.custom_points
*= 72.0f
/ 0.0254f
;
917 else if (!strcasecmp(units
, "in"))
918 cparam
->current
.custom_points
*= 72.0f
;
919 else if (!strcasecmp(units
, "ft"))
920 cparam
->current
.custom_points
*= 12.0f
* 72.0f
;
924 case PPD_CUSTOM_INT
:
925 cparam
->current
.custom_int
= atoi(val
->value
);
928 case PPD_CUSTOM_PASSCODE
:
929 case PPD_CUSTOM_PASSWORD
:
930 case PPD_CUSTOM_STRING
:
931 if (cparam
->current
.custom_string
)
932 _cupsStrFree(cparam
->current
.custom_string
);
934 cparam
->current
.custom_string
= _cupsStrAlloc(val
->value
);
939 cupsFreeOptions(num_vals
, vals
);
944 for (i
= o
->num_choices
, c
= o
->choices
; i
> 0; i
--, c
++)
945 if (!strcasecmp(c
->choice
, choice
))
953 * Option found; mark it and then handle unmarking any other options.
956 if (o
->ui
!= PPD_UI_PICKMANY
)
959 * Unmark all other choices...
962 if ((oldc
= (ppd_choice_t
*)cupsArrayFind(ppd
->marked
, c
)) != NULL
)
965 cupsArrayRemove(ppd
->marked
, oldc
);
968 if (!strcasecmp(option
, "PageSize") || !strcasecmp(option
, "PageRegion"))
971 * Mark current page size...
974 for (j
= 0; j
< ppd
->num_sizes
; j
++)
975 ppd
->sizes
[j
].marked
= !strcasecmp(ppd
->sizes
[j
].name
,
979 * Unmark the current PageSize or PageRegion setting, as
983 if (!strcasecmp(option
, "PageSize"))
985 if ((o
= ppdFindOption(ppd
, "PageRegion")) != NULL
)
988 if ((oldc
= (ppd_choice_t
*)cupsArrayFind(ppd
->marked
, &key
)) != NULL
)
991 cupsArrayRemove(ppd
->marked
, oldc
);
997 if ((o
= ppdFindOption(ppd
, "PageSize")) != NULL
)
1000 if ((oldc
= (ppd_choice_t
*)cupsArrayFind(ppd
->marked
, &key
)) != NULL
)
1003 cupsArrayRemove(ppd
->marked
, oldc
);
1008 else if (!strcasecmp(option
, "InputSlot"))
1011 * Unmark ManualFeed option...
1014 if ((o
= ppdFindOption(ppd
, "ManualFeed")) != NULL
)
1017 if ((oldc
= (ppd_choice_t
*)cupsArrayFind(ppd
->marked
, &key
)) != NULL
)
1020 cupsArrayRemove(ppd
->marked
, oldc
);
1024 else if (!strcasecmp(option
, "ManualFeed") &&
1025 !strcasecmp(choice
, "True"))
1028 * Unmark InputSlot option...
1031 if ((o
= ppdFindOption(ppd
, "InputSlot")) != NULL
)
1034 if ((oldc
= (ppd_choice_t
*)cupsArrayFind(ppd
->marked
, &key
)) != NULL
)
1037 cupsArrayRemove(ppd
->marked
, oldc
);
1045 cupsArrayAdd(ppd
->marked
, c
);
1050 * End of "$Id: mark.c 7757 2008-07-18 16:43:43Z mike $".