Coverage Report

Created: 2026-10-28 08:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cups/cups/ppd-custom.c
Line
Count
Source
1
/*
2
 * PPD custom option routines for CUPS.
3
 *
4
 * Copyright 2007-2015 by Apple Inc.
5
 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
6
 *
7
 * These coded instructions, statements, and computer programs are the
8
 * property of Apple Inc. and are protected by Federal copyright
9
 * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
10
 * which should have been included with this file.  If this file is
11
 * missing or damaged, see the license at "http://www.cups.org/".
12
 *
13
 * PostScript is a trademark of Adobe Systems, Inc.
14
 *
15
 * This code and any derivative of it may be used and distributed
16
 * freely under the terms of the GNU General Public License when
17
 * used with GNU Ghostscript or its derivatives.  Use of the code
18
 * (or any derivative of it) with software other than GNU
19
 * GhostScript (or its derivatives) is governed by the CUPS license
20
 * agreement.
21
 *
22
 * This file is subject to the Apple OS-Developed Software exception.
23
 */
24
25
/*
26
 * Include necessary headers.
27
 */
28
29
#include "cups-private.h"
30
#include "ppd-private.h"
31
32
33
/*
34
 * 'ppdFindCustomOption()' - Find a custom option.
35
 *
36
 * @since CUPS 1.2/macOS 10.5@
37
 */
38
39
ppd_coption_t *       /* O - Custom option or NULL */
40
ppdFindCustomOption(ppd_file_t *ppd,  /* I - PPD file */
41
                    const char *keyword)/* I - Custom option name */
42
0
{
43
0
  ppd_coption_t key;      /* Custom option search key */
44
45
46
0
  if (!ppd)
47
0
    return (NULL);
48
49
0
  strlcpy(key.keyword, keyword, sizeof(key.keyword));
50
0
  return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
51
0
}
52
53
54
/*
55
 * 'ppdFindCustomParam()' - Find a parameter for a custom option.
56
 *
57
 * @since CUPS 1.2/macOS 10.5@
58
 */
59
60
ppd_cparam_t *        /* O - Custom parameter or NULL */
61
ppdFindCustomParam(ppd_coption_t *opt,  /* I - Custom option */
62
                   const char    *name) /* I - Parameter name */
63
0
{
64
0
  ppd_cparam_t  *param;     /* Current custom parameter */
65
66
67
0
  if (!opt)
68
0
    return (NULL);
69
70
0
  for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params);
71
0
       param;
72
0
       param = (ppd_cparam_t *)cupsArrayNext(opt->params))
73
0
    if (!_cups_strcasecmp(param->name, name))
74
0
      break;
75
76
0
  return (param);
77
0
}
78
79
80
/*
81
 * 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
82
 *
83
 * @since CUPS 1.2/macOS 10.5@
84
 */
85
86
ppd_cparam_t *        /* O - Custom parameter or NULL */
87
ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
88
0
{
89
0
  if (!opt)
90
0
    return (NULL);
91
92
0
  return ((ppd_cparam_t *)cupsArrayFirst(opt->params));
93
0
}
94
95
96
/*
97
 * 'ppdNextCustomParam()' - Return the next parameter for a custom option.
98
 *
99
 * @since CUPS 1.2/macOS 10.5@
100
 */
101
102
ppd_cparam_t *        /* O - Custom parameter or NULL */
103
ppdNextCustomParam(ppd_coption_t *opt)  /* I - Custom option */
104
0
{
105
0
  if (!opt)
106
0
    return (NULL);
107
108
0
  return ((ppd_cparam_t *)cupsArrayNext(opt->params));
109
0
}