]>
Commit | Line | Data |
---|---|---|
fa73b229 | 1 | /* |
bc44d920 | 2 | * "$Id: custom.c 6649 2007-07-11 21:46:42Z mike $" |
fa73b229 | 3 | * |
4 | * PPD custom option routines for the Common UNIX Printing System (CUPS). | |
5 | * | |
bc44d920 | 6 | * Copyright 2007 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 | ||
38 | #include "globals.h" | |
39 | #include "debug.h" | |
40 | ||
41 | ||
42 | /* | |
43 | * 'ppdFindCustomOption()' - Find a custom option. | |
89d46774 | 44 | * |
45 | * @since CUPS 1.2@ | |
fa73b229 | 46 | */ |
47 | ||
48 | ppd_coption_t * /* O - Custom option or NULL */ | |
49 | ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */ | |
50 | const char *keyword)/* I - Custom option name */ | |
51 | { | |
52 | ppd_coption_t key; /* Custom option search key */ | |
53 | ||
54 | ||
55 | if (!ppd) | |
56 | return (NULL); | |
57 | ||
58 | strlcpy(key.keyword, keyword, sizeof(key.keyword)); | |
59 | return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key)); | |
60 | } | |
61 | ||
62 | ||
63 | /* | |
64 | * 'ppdFindCustomParam()' - Find a parameter for a custom option. | |
89d46774 | 65 | * |
66 | * @since CUPS 1.2@ | |
fa73b229 | 67 | */ |
68 | ||
69 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
70 | ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */ | |
71 | const char *name) /* I - Parameter name */ | |
72 | { | |
73 | ppd_cparam_t key; /* Custom parameter search key */ | |
74 | ||
75 | ||
76 | if (!opt) | |
77 | return (NULL); | |
78 | ||
79 | strlcpy(key.name, name, sizeof(key.name)); | |
80 | return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key)); | |
81 | } | |
82 | ||
83 | ||
84 | /* | |
85 | * 'ppdFirstCustomParam()' - Return the first parameter for a custom option. | |
89d46774 | 86 | * |
87 | * @since CUPS 1.2@ | |
fa73b229 | 88 | */ |
89 | ||
90 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
91 | ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */ | |
92 | { | |
93 | if (!opt) | |
94 | return (NULL); | |
95 | ||
96 | return ((ppd_cparam_t *)cupsArrayFirst(opt->params)); | |
97 | } | |
98 | ||
99 | ||
100 | /* | |
101 | * 'ppdNextCustomParam()' - Return the next parameter for a custom option. | |
89d46774 | 102 | * |
103 | * @since CUPS 1.2@ | |
fa73b229 | 104 | */ |
105 | ||
106 | ppd_cparam_t * /* O - Custom parameter or NULL */ | |
107 | ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */ | |
108 | { | |
109 | if (!opt) | |
110 | return (NULL); | |
111 | ||
112 | return ((ppd_cparam_t *)cupsArrayNext(opt->params)); | |
113 | } | |
114 | ||
115 | ||
116 | /* | |
bc44d920 | 117 | * End of "$Id: custom.c 6649 2007-07-11 21:46:42Z mike $". |
fa73b229 | 118 | */ |