]>
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 | * |
71e16022 | 6 | * Copyright 2007-2010 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 | * |
426c6a59 | 44 | * @since CUPS 1.2/Mac 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 | * |
426c6a59 | 65 | * @since CUPS 1.2/Mac 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 | { | |
72 | ppd_cparam_t key; /* Custom parameter search key */ | |
73 | ||
74 | ||
75 | if (!opt) | |
76 | return (NULL); | |
77 | ||
78 | strlcpy(key.name, name, sizeof(key.name)); | |
79 | return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key)); | |
80 | } | |
81 | ||
82 | ||
83 | /* | |
84 | * 'ppdFirstCustomParam()' - Return the first parameter for a custom option. | |
89d46774 | 85 | * |
426c6a59 | 86 | * @since CUPS 1.2/Mac OS X 10.5@ |
fa73b229 | 87 | */ |
88 | ||
89 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
90 | ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */ | |
91 | { | |
92 | if (!opt) | |
93 | return (NULL); | |
94 | ||
95 | return ((ppd_cparam_t *)cupsArrayFirst(opt->params)); | |
96 | } | |
97 | ||
98 | ||
99 | /* | |
100 | * 'ppdNextCustomParam()' - Return the next parameter for a custom option. | |
89d46774 | 101 | * |
426c6a59 | 102 | * @since CUPS 1.2/Mac OS X 10.5@ |
fa73b229 | 103 | */ |
104 | ||
105 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
106 | ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */ | |
107 | { | |
108 | if (!opt) | |
109 | return (NULL); | |
110 | ||
111 | return ((ppd_cparam_t *)cupsArrayNext(opt->params)); | |
112 | } | |
113 | ||
114 | ||
115 | /* | |
bc44d920 | 116 | * End of "$Id: custom.c 6649 2007-07-11 21:46:42Z mike $". |
fa73b229 | 117 | */ |