]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/custom.c
4 * PPD custom option routines for CUPS.
6 * Copyright 2007-2012 by Apple Inc.
7 * Copyright 1997-2006 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 code and any derivative of it may be used and distributed
18 * freely under the terms of the GNU General Public License when
19 * used with GNU Ghostscript or its derivatives. Use of the code
20 * (or any derivative of it) with software other than GNU
21 * GhostScript (or its derivatives) is governed by the CUPS license
24 * This file is subject to the Apple OS-Developed Software exception.
28 * ppdFindCustomOption() - Find a custom option.
29 * ppdFindCustomParam() - Find a parameter for a custom option.
30 * ppdFirstCustomParam() - Return the first parameter for a custom option.
31 * ppdNextCustomParam() - Return the next parameter for a custom option.
35 * Include necessary headers.
38 #include "cups-private.h"
42 * 'ppdFindCustomOption()' - Find a custom option.
44 * @since CUPS 1.2/OS X 10.5@
47 ppd_coption_t
* /* O - Custom option or NULL */
48 ppdFindCustomOption(ppd_file_t
*ppd
, /* I - PPD file */
49 const char *keyword
)/* I - Custom option name */
51 ppd_coption_t key
; /* Custom option search key */
57 strlcpy(key
.keyword
, keyword
, sizeof(key
.keyword
));
58 return ((ppd_coption_t
*)cupsArrayFind(ppd
->coptions
, &key
));
63 * 'ppdFindCustomParam()' - Find a parameter for a custom option.
65 * @since CUPS 1.2/OS X 10.5@
68 ppd_cparam_t
* /* O - Custom parameter or NULL */
69 ppdFindCustomParam(ppd_coption_t
*opt
, /* I - Custom option */
70 const char *name
) /* I - Parameter name */
72 ppd_cparam_t
*param
; /* Current custom parameter */
78 for (param
= (ppd_cparam_t
*)cupsArrayFirst(opt
->params
);
80 param
= (ppd_cparam_t
*)cupsArrayNext(opt
->params
))
81 if (!_cups_strcasecmp(param
->name
, name
))
89 * 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
91 * @since CUPS 1.2/OS X 10.5@
94 ppd_cparam_t
* /* O - Custom parameter or NULL */
95 ppdFirstCustomParam(ppd_coption_t
*opt
) /* I - Custom option */
100 return ((ppd_cparam_t
*)cupsArrayFirst(opt
->params
));
105 * 'ppdNextCustomParam()' - Return the next parameter for a custom option.
107 * @since CUPS 1.2/OS X 10.5@
110 ppd_cparam_t
* /* O - Custom parameter or NULL */
111 ppdNextCustomParam(ppd_coption_t
*opt
) /* I - Custom option */
116 return ((ppd_cparam_t
*)cupsArrayNext(opt
->params
));