]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/ppd-custom.c
Fix source file header text duplication text duplication.
[thirdparty/cups.git] / cups / ppd-custom.c
CommitLineData
fa73b229 1/*
f787e1e3 2 * PPD custom option routines for CUPS.
fa73b229 3 *
f787e1e3
MS
4 * Copyright 2007-2015 by Apple Inc.
5 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
fa73b229 6 *
f787e1e3
MS
7 * These coded instructions, statements, and computer programs are the
8 * property of Apple Inc. and are protected by Federal copyright
9 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 * which should have been included with this file. If this file is
57b7b66b 11 * missing or damaged, see the license at "http://www.cups.org/".
fa73b229 12 *
f787e1e3 13 * PostScript is a trademark of Adobe Systems, Inc.
fa73b229 14 *
f787e1e3
MS
15 * This code and any derivative of it may be used and distributed
16 * freely under the terms of the GNU General Public License when
17 * used with GNU Ghostscript or its derivatives. Use of the code
18 * (or any derivative of it) with software other than GNU
19 * GhostScript (or its derivatives) is governed by the CUPS license
20 * agreement.
fa73b229 21 *
f787e1e3 22 * This file is subject to the Apple OS-Developed Software exception.
fa73b229 23 */
24
25/*
26 * Include necessary headers.
27 */
28
71e16022 29#include "cups-private.h"
f787e1e3 30#include "ppd-private.h"
fa73b229 31
32
33/*
34 * 'ppdFindCustomOption()' - Find a custom option.
89d46774 35 *
8072030b 36 * @since CUPS 1.2/macOS 10.5@
fa73b229 37 */
38
39ppd_coption_t * /* O - Custom option or NULL */
40ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
41 const char *keyword)/* I - Custom option name */
42{
43 ppd_coption_t key; /* Custom option search key */
44
45
46 if (!ppd)
47 return (NULL);
48
49 strlcpy(key.keyword, keyword, sizeof(key.keyword));
50 return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
51}
52
53
54/*
55 * 'ppdFindCustomParam()' - Find a parameter for a custom option.
89d46774 56 *
8072030b 57 * @since CUPS 1.2/macOS 10.5@
fa73b229 58 */
59
60ppd_cparam_t * /* O - Custom parameter or NULL */
61ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
62 const char *name) /* I - Parameter name */
63{
0268488e 64 ppd_cparam_t *param; /* Current custom parameter */
fa73b229 65
66
67 if (!opt)
68 return (NULL);
69
0268488e
MS
70 for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params);
71 param;
72 param = (ppd_cparam_t *)cupsArrayNext(opt->params))
88f9aafc 73 if (!_cups_strcasecmp(param->name, name))
0268488e
MS
74 break;
75
76 return (param);
fa73b229 77}
78
79
80/*
81 * 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
89d46774 82 *
8072030b 83 * @since CUPS 1.2/macOS 10.5@
fa73b229 84 */
85
86ppd_cparam_t * /* O - Custom parameter or NULL */
87ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
88{
89 if (!opt)
90 return (NULL);
91
92 return ((ppd_cparam_t *)cupsArrayFirst(opt->params));
93}
94
95
96/*
97 * 'ppdNextCustomParam()' - Return the next parameter for a custom option.
89d46774 98 *
8072030b 99 * @since CUPS 1.2/macOS 10.5@
fa73b229 100 */
101
102ppd_cparam_t * /* O - Custom parameter or NULL */
103ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */
104{
105 if (!opt)
106 return (NULL);
107
108 return ((ppd_cparam_t *)cupsArrayNext(opt->params));
109}