]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/custom.c
Load cups into easysw/current.
[thirdparty/cups.git] / cups / custom.c
CommitLineData
fa73b229 1/*
f7faf1f5 2 * "$Id: custom.c 5391 2006-04-14 12:26:50Z mike $"
fa73b229 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 *
89d46774 37 * ppdFindCustomOption() - Find a custom option.
38 * ppdFindCustomParam() - Find a parameter for a custom option.
39 * ppdFirstCustomParam() - Return the first parameter for a custom option.
40 * ppdNextCustomParam() - Return the next parameter for a custom option.
fa73b229 41 */
42
43/*
44 * Include necessary headers.
45 */
46
47#include "globals.h"
48#include "debug.h"
49
50
51/*
52 * 'ppdFindCustomOption()' - Find a custom option.
89d46774 53 *
54 * @since CUPS 1.2@
fa73b229 55 */
56
57ppd_coption_t * /* O - Custom option or NULL */
58ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
59 const char *keyword)/* I - Custom option name */
60{
61 ppd_coption_t key; /* Custom option search key */
62
63
64 if (!ppd)
65 return (NULL);
66
67 strlcpy(key.keyword, keyword, sizeof(key.keyword));
68 return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
69}
70
71
72/*
73 * 'ppdFindCustomParam()' - Find a parameter for a custom option.
89d46774 74 *
75 * @since CUPS 1.2@
fa73b229 76 */
77
78ppd_cparam_t * /* O - Custom parameter or NULL */
79ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
80 const char *name) /* I - Parameter name */
81{
82 ppd_cparam_t key; /* Custom parameter search key */
83
84
85 if (!opt)
86 return (NULL);
87
88 strlcpy(key.name, name, sizeof(key.name));
89 return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key));
90}
91
92
93/*
94 * 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
89d46774 95 *
96 * @since CUPS 1.2@
fa73b229 97 */
98
99ppd_cparam_t * /* O - Custom parameter or NULL */
100ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
101{
102 if (!opt)
103 return (NULL);
104
105 return ((ppd_cparam_t *)cupsArrayFirst(opt->params));
106}
107
108
109/*
110 * 'ppdNextCustomParam()' - Return the next parameter for a custom option.
89d46774 111 *
112 * @since CUPS 1.2@
fa73b229 113 */
114
115ppd_cparam_t * /* O - Custom parameter or NULL */
116ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */
117{
118 if (!opt)
119 return (NULL);
120
121 return ((ppd_cparam_t *)cupsArrayNext(opt->params));
122}
123
124
125/*
f7faf1f5 126 * End of "$Id: custom.c 5391 2006-04-14 12:26:50Z mike $".
fa73b229 127 */