]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/custom.c
1d44826654ad5dbad668bac4b4d6b40eb9ddb461
[thirdparty/cups.git] / cups / custom.c
1 /*
2 * "$Id: custom.c 4938 2006-01-17 15:11:15Z mike $"
3 *
4 * PPD custom option routines for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
7 *
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
13 * at:
14 *
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
19 *
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
23 *
24 * PostScript is a trademark of Adobe Systems, Inc.
25 *
26 * This code and any derivative of it may be used and distributed
27 * freely under the terms of the GNU General Public License when
28 * used with GNU Ghostscript or its derivatives. Use of the code
29 * (or any derivative of it) with software other than GNU
30 * GhostScript (or its derivatives) is governed by the CUPS license
31 * agreement.
32 *
33 * This file is subject to the Apple OS-Developed Software exception.
34 *
35 * Contents:
36 *
37 */
38
39 /*
40 * Include necessary headers.
41 */
42
43 #include "globals.h"
44 #include "debug.h"
45
46
47 /*
48 * 'ppdFindCustomOption()' - Find a custom option.
49 */
50
51 ppd_coption_t * /* O - Custom option or NULL */
52 ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
53 const char *keyword)/* I - Custom option name */
54 {
55 ppd_coption_t key; /* Custom option search key */
56
57
58 if (!ppd)
59 return (NULL);
60
61 strlcpy(key.keyword, keyword, sizeof(key.keyword));
62 return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
63 }
64
65
66 /*
67 * 'ppdFindCustomParam()' - Find a parameter for a custom option.
68 */
69
70 ppd_cparam_t * /* O - Custom parameter or NULL */
71 ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
72 const char *name) /* I - Parameter name */
73 {
74 ppd_cparam_t key; /* Custom parameter search key */
75
76
77 if (!opt)
78 return (NULL);
79
80 strlcpy(key.name, name, sizeof(key.name));
81 return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key));
82 }
83
84
85 /*
86 * 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
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.
101 */
102
103 ppd_cparam_t * /* O - Custom parameter or NULL */
104 ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */
105 {
106 if (!opt)
107 return (NULL);
108
109 return ((ppd_cparam_t *)cupsArrayNext(opt->params));
110 }
111
112
113 /*
114 * End of "$Id: custom.c 4938 2006-01-17 15:11:15Z mike $".
115 */