]>
Commit | Line | Data |
---|---|---|
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 | * |
4b042bf6 MS |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
8 | * information. | |
fa73b229 | 9 | * |
f787e1e3 | 10 | * PostScript is a trademark of Adobe Systems, Inc. |
fa73b229 | 11 | */ |
12 | ||
13 | /* | |
14 | * Include necessary headers. | |
15 | */ | |
16 | ||
71e16022 | 17 | #include "cups-private.h" |
f787e1e3 | 18 | #include "ppd-private.h" |
fb863569 | 19 | #include "debug-internal.h" |
fa73b229 | 20 | |
21 | ||
22 | /* | |
23 | * 'ppdFindCustomOption()' - Find a custom option. | |
89d46774 | 24 | * |
8072030b | 25 | * @since CUPS 1.2/macOS 10.5@ |
fa73b229 | 26 | */ |
27 | ||
28 | ppd_coption_t * /* O - Custom option or NULL */ | |
29 | ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */ | |
30 | const char *keyword)/* I - Custom option name */ | |
31 | { | |
32 | ppd_coption_t key; /* Custom option search key */ | |
33 | ||
34 | ||
35 | if (!ppd) | |
36 | return (NULL); | |
37 | ||
38 | strlcpy(key.keyword, keyword, sizeof(key.keyword)); | |
39 | return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key)); | |
40 | } | |
41 | ||
42 | ||
43 | /* | |
44 | * 'ppdFindCustomParam()' - Find a parameter for a custom option. | |
89d46774 | 45 | * |
8072030b | 46 | * @since CUPS 1.2/macOS 10.5@ |
fa73b229 | 47 | */ |
48 | ||
49 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
50 | ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */ | |
51 | const char *name) /* I - Parameter name */ | |
52 | { | |
0268488e | 53 | ppd_cparam_t *param; /* Current custom parameter */ |
fa73b229 | 54 | |
55 | ||
56 | if (!opt) | |
57 | return (NULL); | |
58 | ||
0268488e MS |
59 | for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params); |
60 | param; | |
61 | param = (ppd_cparam_t *)cupsArrayNext(opt->params)) | |
88f9aafc | 62 | if (!_cups_strcasecmp(param->name, name)) |
0268488e MS |
63 | break; |
64 | ||
65 | return (param); | |
fa73b229 | 66 | } |
67 | ||
68 | ||
69 | /* | |
70 | * 'ppdFirstCustomParam()' - Return the first parameter for a custom option. | |
89d46774 | 71 | * |
8072030b | 72 | * @since CUPS 1.2/macOS 10.5@ |
fa73b229 | 73 | */ |
74 | ||
75 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
76 | ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */ | |
77 | { | |
78 | if (!opt) | |
79 | return (NULL); | |
80 | ||
81 | return ((ppd_cparam_t *)cupsArrayFirst(opt->params)); | |
82 | } | |
83 | ||
84 | ||
85 | /* | |
86 | * 'ppdNextCustomParam()' - Return the next parameter for a custom option. | |
89d46774 | 87 | * |
8072030b | 88 | * @since CUPS 1.2/macOS 10.5@ |
fa73b229 | 89 | */ |
90 | ||
91 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
92 | ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */ | |
93 | { | |
94 | if (!opt) | |
95 | return (NULL); | |
96 | ||
97 | return ((ppd_cparam_t *)cupsArrayNext(opt->params)); | |
98 | } |