]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/ppd-custom.c
Map , to p in phone numbers.
[thirdparty/cups.git] / cups / ppd-custom.c
CommitLineData
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"
fa73b229 19
20
21/*
22 * 'ppdFindCustomOption()' - Find a custom option.
89d46774 23 *
8072030b 24 * @since CUPS 1.2/macOS 10.5@
fa73b229 25 */
26
27ppd_coption_t * /* O - Custom option or NULL */
28ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
29 const char *keyword)/* I - Custom option name */
30{
31 ppd_coption_t key; /* Custom option search key */
32
33
34 if (!ppd)
35 return (NULL);
36
37 strlcpy(key.keyword, keyword, sizeof(key.keyword));
38 return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
39}
40
41
42/*
43 * 'ppdFindCustomParam()' - Find a parameter for a custom option.
89d46774 44 *
8072030b 45 * @since CUPS 1.2/macOS 10.5@
fa73b229 46 */
47
48ppd_cparam_t * /* O - Custom parameter or NULL */
49ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
50 const char *name) /* I - Parameter name */
51{
0268488e 52 ppd_cparam_t *param; /* Current custom parameter */
fa73b229 53
54
55 if (!opt)
56 return (NULL);
57
0268488e
MS
58 for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params);
59 param;
60 param = (ppd_cparam_t *)cupsArrayNext(opt->params))
88f9aafc 61 if (!_cups_strcasecmp(param->name, name))
0268488e
MS
62 break;
63
64 return (param);
fa73b229 65}
66
67
68/*
69 * 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
89d46774 70 *
8072030b 71 * @since CUPS 1.2/macOS 10.5@
fa73b229 72 */
73
74ppd_cparam_t * /* O - Custom parameter or NULL */
75ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
76{
77 if (!opt)
78 return (NULL);
79
80 return ((ppd_cparam_t *)cupsArrayFirst(opt->params));
81}
82
83
84/*
85 * 'ppdNextCustomParam()' - Return the next parameter for a custom option.
89d46774 86 *
8072030b 87 * @since CUPS 1.2/macOS 10.5@
fa73b229 88 */
89
90ppd_cparam_t * /* O - Custom parameter or NULL */
91ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */
92{
93 if (!opt)
94 return (NULL);
95
96 return ((ppd_cparam_t *)cupsArrayNext(opt->params));
97}