]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/ppd-custom.c
2 * PPD custom option routines for CUPS.
4 * Copyright 2007-2015 by Apple Inc.
5 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
9 * PostScript is a trademark of Adobe Systems, Inc.
11 * This code and any derivative of it may be used and distributed
12 * freely under the terms of the GNU General Public License when
13 * used with GNU Ghostscript or its derivatives. Use of the code
14 * (or any derivative of it) with software other than GNU
15 * GhostScript (or its derivatives) is governed by the CUPS license
20 * Include necessary headers.
23 #include "cups-private.h"
24 #include "ppd-private.h"
28 * 'ppdFindCustomOption()' - Find a custom option.
30 * @since CUPS 1.2/macOS 10.5@
33 ppd_coption_t
* /* O - Custom option or NULL */
34 ppdFindCustomOption(ppd_file_t
*ppd
, /* I - PPD file */
35 const char *keyword
)/* I - Custom option name */
37 ppd_coption_t key
; /* Custom option search key */
43 strlcpy(key
.keyword
, keyword
, sizeof(key
.keyword
));
44 return ((ppd_coption_t
*)cupsArrayFind(ppd
->coptions
, &key
));
49 * 'ppdFindCustomParam()' - Find a parameter for a custom option.
51 * @since CUPS 1.2/macOS 10.5@
54 ppd_cparam_t
* /* O - Custom parameter or NULL */
55 ppdFindCustomParam(ppd_coption_t
*opt
, /* I - Custom option */
56 const char *name
) /* I - Parameter name */
58 ppd_cparam_t
*param
; /* Current custom parameter */
64 for (param
= (ppd_cparam_t
*)cupsArrayFirst(opt
->params
);
66 param
= (ppd_cparam_t
*)cupsArrayNext(opt
->params
))
67 if (!_cups_strcasecmp(param
->name
, name
))
75 * 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
77 * @since CUPS 1.2/macOS 10.5@
80 ppd_cparam_t
* /* O - Custom parameter or NULL */
81 ppdFirstCustomParam(ppd_coption_t
*opt
) /* I - Custom option */
86 return ((ppd_cparam_t
*)cupsArrayFirst(opt
->params
));
91 * 'ppdNextCustomParam()' - Return the next parameter for a custom option.
93 * @since CUPS 1.2/macOS 10.5@
96 ppd_cparam_t
* /* O - Custom parameter or NULL */
97 ppdNextCustomParam(ppd_coption_t
*opt
) /* I - Custom option */
102 return ((ppd_cparam_t
*)cupsArrayNext(opt
->params
));