]>
Commit | Line | Data |
---|---|---|
fa73b229 | 1 | /* |
bc44d920 | 2 | * "$Id: custom.c 6649 2007-07-11 21:46:42Z mike $" |
fa73b229 | 3 | * |
71e16022 | 4 | * PPD custom option routines for CUPS. |
fa73b229 | 5 | * |
f3c17241 | 6 | * Copyright 2007-2012 by Apple Inc. |
fa73b229 | 7 | * Copyright 1997-2006 by Easy Software Products, all rights reserved. |
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/". | |
fa73b229 | 14 | * |
15 | * PostScript is a trademark of Adobe Systems, Inc. | |
16 | * | |
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 | |
22 | * agreement. | |
23 | * | |
24 | * This file is subject to the Apple OS-Developed Software exception. | |
25 | * | |
26 | * Contents: | |
27 | * | |
89d46774 | 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. | |
fa73b229 | 32 | */ |
33 | ||
34 | /* | |
35 | * Include necessary headers. | |
36 | */ | |
37 | ||
71e16022 | 38 | #include "cups-private.h" |
fa73b229 | 39 | |
40 | ||
41 | /* | |
42 | * 'ppdFindCustomOption()' - Find a custom option. | |
89d46774 | 43 | * |
f3c17241 | 44 | * @since CUPS 1.2/OS X 10.5@ |
fa73b229 | 45 | */ |
46 | ||
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 */ | |
50 | { | |
51 | ppd_coption_t key; /* Custom option search key */ | |
52 | ||
53 | ||
54 | if (!ppd) | |
55 | return (NULL); | |
56 | ||
57 | strlcpy(key.keyword, keyword, sizeof(key.keyword)); | |
58 | return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key)); | |
59 | } | |
60 | ||
61 | ||
62 | /* | |
63 | * 'ppdFindCustomParam()' - Find a parameter for a custom option. | |
89d46774 | 64 | * |
f3c17241 | 65 | * @since CUPS 1.2/OS X 10.5@ |
fa73b229 | 66 | */ |
67 | ||
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 */ | |
71 | { | |
0268488e | 72 | ppd_cparam_t *param; /* Current custom parameter */ |
fa73b229 | 73 | |
74 | ||
75 | if (!opt) | |
76 | return (NULL); | |
77 | ||
0268488e MS |
78 | for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params); |
79 | param; | |
80 | param = (ppd_cparam_t *)cupsArrayNext(opt->params)) | |
88f9aafc | 81 | if (!_cups_strcasecmp(param->name, name)) |
0268488e MS |
82 | break; |
83 | ||
84 | return (param); | |
fa73b229 | 85 | } |
86 | ||
87 | ||
88 | /* | |
89 | * 'ppdFirstCustomParam()' - Return the first parameter for a custom option. | |
89d46774 | 90 | * |
f3c17241 | 91 | * @since CUPS 1.2/OS X 10.5@ |
fa73b229 | 92 | */ |
93 | ||
94 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
95 | ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */ | |
96 | { | |
97 | if (!opt) | |
98 | return (NULL); | |
99 | ||
100 | return ((ppd_cparam_t *)cupsArrayFirst(opt->params)); | |
101 | } | |
102 | ||
103 | ||
104 | /* | |
105 | * 'ppdNextCustomParam()' - Return the next parameter for a custom option. | |
89d46774 | 106 | * |
f3c17241 | 107 | * @since CUPS 1.2/OS X 10.5@ |
fa73b229 | 108 | */ |
109 | ||
110 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
111 | ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */ | |
112 | { | |
113 | if (!opt) | |
114 | return (NULL); | |
115 | ||
116 | return ((ppd_cparam_t *)cupsArrayNext(opt->params)); | |
117 | } | |
118 | ||
119 | ||
120 | /* | |
bc44d920 | 121 | * End of "$Id: custom.c 6649 2007-07-11 21:46:42Z mike $". |
fa73b229 | 122 | */ |