]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/api-cups.html
Load cups into easysw/current.
[thirdparty/cups.git] / doc / help / api-cups.html
CommitLineData
ef416fc2 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2<html>
3<!-- SECTION: Programming -->
4<head>
5 <title>CUPS API</title>
6 <meta name='keywords' content='Programming'>
7 <meta name='creator' content='Mini-XML v2.3'>
8 <style type='text/css'><!--
9 h1, h2, h3, p { font-family: sans-serif; text-align: justify; }
10 tt, pre a:link, pre a:visited, tt a:link, tt a:visited { font-weight: bold; color: #7f0000; }
11 pre { font-weight: bold; color: #7f0000; margin-left: 2em; }
12 span.info { background: #000000; border: solid thin #000000; color: #ffffff; font-size: 80%; font-style: italic; font-weight: bold; white-space: nowrap; }
13 h3 span.info { float: right; font-size: 100%; }
14 h1.title, h2.title, h3.title { border-bottom: solid 2px #000000; }
15 --></style>
16</head>
17<body>
18<!--
bc44d920 19 "$Id: api-cups.shtml 6649 2007-07-11 21:46:42Z mike $"
ef416fc2 20
21 CUPS API introduction for the Common UNIX Printing System (CUPS).
22
bc44d920 23 Copyright 2007 by Apple Inc.
24 Copyright 1997-2006 by Easy Software Products, all rights reserved.
ef416fc2 25
26 These coded instructions, statements, and computer programs are the
bc44d920 27 property of Apple Inc. and are protected by Federal copyright
28 law. Distribution and use rights are outlined in the file "LICENSE.txt"
29 which should have been included with this file. If this file is
30 file is missing or damaged, see the license at "http://www.cups.org/".
ef416fc2 31-->
32
33<h2 class='title'>Introduction</h2>
34
ecdc0628 35<p>The CUPS library provides a whole collection of interfaces
36needed to support the internal needs of the CUPS software as well
37as the needs of applications, filters, printer drivers, and
38backends.</p>
39
40<p>Unlike the rest of CUPS, the CUPS API library is provided
41under the GNU Library General Public License. This means that you
42can use the CUPS API library in both proprietary and open-source
43programs.</p>
ef416fc2 44
45<h2 class='title'>General Usage</h2>
46
47<p>The <var>&lt;cups/cups.h&gt;</var> header file must be included to
48use the CUPS functions.</p>
49
50<p>Programs using these functions must be linked to the CUPS
51library: <var>libcups.a</var>, <var>libcups.so.2</var>,
52<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
53<var>libcups2.lib</var> depending on the platform. The following
54command compiles <var>myprogram.c</var> using GCC and the CUPS
55library:</p>
56
57<pre class='command'>
58<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
59</pre>
60
61<h2 class='title'>Compatibility</h2>
62
63<p>Unless otherwise specified, the CUPS API functions require
64CUPS 1.1 or higher.</p>
65<h2 class='title'>Contents</h2>
66<ul>
67 <li><a href='#ENUMERATIONS'>Enumerations</a></li>
68 <li><a href='#FUNCTIONS'>Functions</a></li>
69 <li><a href='#STRUCTURES'>Structures</a></li>
70 <li><a href='#TYPES'>Types</a></li>
71</ul>
72<!-- NEW PAGE -->
73<h2 class='title'><a name='ENUMERATIONS'>Enumerations</a></h2>
74<ul>
75 <li><a href='#cups_ptype_e'><tt>cups_ptype_e</tt></a> </li>
76</ul>
77<!-- NEW PAGE -->
78<h3 class='title'><a name='cups_ptype_e'>cups_ptype_e</a></h3>
79<h4>Description</h4>
bc44d920 80<p>Not a typedef'd enum so we can OR
ef416fc2 81<h4>Values</h4>
bc44d920 82<div class='table'><table align='center' border='1' width='80%' summary='Values'>
ef416fc2 83<thead><tr><th>Name</th><th>Description</th></tr></thead>
84<tbody>
bc44d920 85<tr><td><tt>CUPS_PRINTER_AUTHENTICATED</tt> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></td><td>Printer requires authentication
86</td></tr>
87<tr><td><tt>CUPS_PRINTER_BIND</tt> </td><td>Can bind output
88</td></tr>
89<tr><td><tt>CUPS_PRINTER_BW</tt> </td><td>Can do B&amp;W printing
90</td></tr>
91<tr><td><tt>CUPS_PRINTER_CLASS</tt> </td><td>Printer class
92</td></tr>
93<tr><td><tt>CUPS_PRINTER_COLLATE</tt> </td><td>Can collage copies
94</td></tr>
95<tr><td><tt>CUPS_PRINTER_COLOR</tt> </td><td>Can do color printing
96</td></tr>
97<tr><td><tt>CUPS_PRINTER_COMMANDS</tt> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></td><td>Printer supports maintenance commands
98</td></tr>
99<tr><td><tt>CUPS_PRINTER_COPIES</tt> </td><td>Can do copies
100</td></tr>
101<tr><td><tt>CUPS_PRINTER_COVER</tt> </td><td>Can cover output
102</td></tr>
103<tr><td><tt>CUPS_PRINTER_DEFAULT</tt> </td><td>Default printer on network
104</td></tr>
105<tr><td><tt>CUPS_PRINTER_DELETE</tt> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></td><td>Delete printer
106</td></tr>
107<tr><td><tt>CUPS_PRINTER_DISCOVERED</tt> <span class='info'>&nbsp;CUPS 1.3&nbsp;</span></td><td>Printer was automatically discovered and added
108</td></tr>
109<tr><td><tt>CUPS_PRINTER_DUPLEX</tt> </td><td>Can do duplexing
110</td></tr>
111<tr><td><tt>CUPS_PRINTER_FAX</tt> </td><td>Fax queue
112</td></tr>
113<tr><td><tt>CUPS_PRINTER_IMPLICIT</tt> </td><td>Implicit class
114</td></tr>
115<tr><td><tt>CUPS_PRINTER_LARGE</tt> </td><td>Can do D/E/A1/A0
116</td></tr>
117<tr><td><tt>CUPS_PRINTER_LOCAL</tt> </td><td>Local printer or class
118</td></tr>
119<tr><td><tt>CUPS_PRINTER_MEDIUM</tt> </td><td>Can do Tabloid/B/C/A3/A2
120</td></tr>
121<tr><td><tt>CUPS_PRINTER_NOT_SHARED</tt> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></td><td>Printer is not shared
122</td></tr>
123<tr><td><tt>CUPS_PRINTER_OPTIONS</tt> </td><td>~(CLASS | REMOTE | IMPLICIT | DEFAULT | FAX | REJECTING | DELETE | NOT_SHARED | AUTHENTICATED | COMMANDS | DISCOVERED)
124</td></tr>
125<tr><td><tt>CUPS_PRINTER_PUNCH</tt> </td><td>Can punch output
126</td></tr>
127<tr><td><tt>CUPS_PRINTER_REJECTING</tt> </td><td>Printer is rejecting jobs
128</td></tr>
129<tr><td><tt>CUPS_PRINTER_REMOTE</tt> </td><td>Remote printer or class
130</td></tr>
131<tr><td><tt>CUPS_PRINTER_SMALL</tt> </td><td>Can do Letter/Legal/A4
132</td></tr>
133<tr><td><tt>CUPS_PRINTER_SORT</tt> </td><td>Can sort output
134</td></tr>
135<tr><td><tt>CUPS_PRINTER_STAPLE</tt> </td><td>Can staple output
136</td></tr>
137<tr><td><tt>CUPS_PRINTER_VARIABLE</tt> </td><td>Can do variable sizes
138</td></tr>
ef416fc2 139</tbody></table></div>
140<!-- NEW PAGE -->
141<h2 class='title'><a name='FUNCTIONS'>Functions</a></h2>
142<ul>
143 <li><a href='#cupsAddDest'><tt>cupsAddDest()</tt></a> </li>
144 <li><a href='#cupsAddOption'><tt>cupsAddOption()</tt></a> </li>
145 <li><a href='#cupsCancelJob'><tt>cupsCancelJob()</tt></a> </li>
ef416fc2 146 <li><a href='#cupsEncryption'><tt>cupsEncryption()</tt></a> </li>
147 <li><a href='#cupsFreeDests'><tt>cupsFreeDests()</tt></a> </li>
148 <li><a href='#cupsFreeJobs'><tt>cupsFreeJobs()</tt></a> </li>
149 <li><a href='#cupsFreeOptions'><tt>cupsFreeOptions()</tt></a> </li>
150 <li><a href='#cupsGetClasses'><tt>cupsGetClasses()</tt></a> <span class='info'>&nbsp;DEPRECATED&nbsp;</span></li>
151 <li><a href='#cupsGetDefault'><tt>cupsGetDefault()</tt></a> </li>
152 <li><a href='#cupsGetDefault2'><tt>cupsGetDefault2()</tt></a> <span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span></li>
153 <li><a href='#cupsGetDest'><tt>cupsGetDest()</tt></a> </li>
154 <li><a href='#cupsGetDests'><tt>cupsGetDests()</tt></a> </li>
155 <li><a href='#cupsGetDests2'><tt>cupsGetDests2()</tt></a> <span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span></li>
156 <li><a href='#cupsGetFd'><tt>cupsGetFd()</tt></a> <span class='info'>&nbsp;CUPS 1.1.20&nbsp;</span></li>
157 <li><a href='#cupsGetFile'><tt>cupsGetFile()</tt></a> <span class='info'>&nbsp;CUPS 1.1.20&nbsp;</span></li>
158 <li><a href='#cupsGetJobs'><tt>cupsGetJobs()</tt></a> </li>
159 <li><a href='#cupsGetJobs2'><tt>cupsGetJobs2()</tt></a> <span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span></li>
160 <li><a href='#cupsGetOption'><tt>cupsGetOption()</tt></a> </li>
161 <li><a href='#cupsGetPPD'><tt>cupsGetPPD()</tt></a> </li>
162 <li><a href='#cupsGetPPD2'><tt>cupsGetPPD2()</tt></a> <span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span></li>
163 <li><a href='#cupsGetPassword'><tt>cupsGetPassword()</tt></a> </li>
164 <li><a href='#cupsGetPrinters'><tt>cupsGetPrinters()</tt></a> <span class='info'>&nbsp;DEPRECATED&nbsp;</span></li>
bc44d920 165 <li><a href='#cupsGetServerPPD'><tt>cupsGetServerPPD()</tt></a> <span class='info'>&nbsp;CUPS 1.3&nbsp;</span></li>
ef416fc2 166 <li><a href='#cupsLangDefault'><tt>cupsLangDefault()</tt></a> </li>
167 <li><a href='#cupsLangEncoding'><tt>cupsLangEncoding()</tt></a> </li>
168 <li><a href='#cupsLangFlush'><tt>cupsLangFlush()</tt></a> </li>
169 <li><a href='#cupsLangFree'><tt>cupsLangFree()</tt></a> </li>
170 <li><a href='#cupsLangGet'><tt>cupsLangGet()</tt></a> </li>
171 <li><a href='#cupsLastError'><tt>cupsLastError()</tt></a> </li>
172 <li><a href='#cupsLastErrorString'><tt>cupsLastErrorString()</tt></a> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></li>
173 <li><a href='#cupsMarkOptions'><tt>cupsMarkOptions()</tt></a> </li>
bc44d920 174 <li><a href='#cupsNotifySubject'><tt>cupsNotifySubject()</tt></a> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></li>
175 <li><a href='#cupsNotifyText'><tt>cupsNotifyText()</tt></a> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></li>
ef416fc2 176 <li><a href='#cupsParseOptions'><tt>cupsParseOptions()</tt></a> </li>
177 <li><a href='#cupsPrintFile'><tt>cupsPrintFile()</tt></a> </li>
178 <li><a href='#cupsPrintFile2'><tt>cupsPrintFile2()</tt></a> <span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span></li>
179 <li><a href='#cupsPrintFiles'><tt>cupsPrintFiles()</tt></a> </li>
180 <li><a href='#cupsPrintFiles2'><tt>cupsPrintFiles2()</tt></a> <span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span></li>
181 <li><a href='#cupsPutFd'><tt>cupsPutFd()</tt></a> <span class='info'>&nbsp;CUPS 1.1.20&nbsp;</span></li>
182 <li><a href='#cupsPutFile'><tt>cupsPutFile()</tt></a> <span class='info'>&nbsp;CUPS 1.1.20&nbsp;</span></li>
f7deaa1a 183 <li><a href='#cupsRemoveDest'><tt>cupsRemoveDest()</tt></a> <span class='info'>&nbsp;CUPS 1.3&nbsp;</span></li>
80ca4592 184 <li><a href='#cupsRemoveOption'><tt>cupsRemoveOption()</tt></a> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></li>
ef416fc2 185 <li><a href='#cupsServer'><tt>cupsServer()</tt></a> </li>
f7deaa1a 186 <li><a href='#cupsSetDefaultDest'><tt>cupsSetDefaultDest()</tt></a> <span class='info'>&nbsp;CUPS 1.3&nbsp;</span></li>
ef416fc2 187 <li><a href='#cupsSetDests'><tt>cupsSetDests()</tt></a> </li>
188 <li><a href='#cupsSetDests2'><tt>cupsSetDests2()</tt></a> <span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span></li>
189 <li><a href='#cupsSetEncryption'><tt>cupsSetEncryption()</tt></a> </li>
190 <li><a href='#cupsSetPasswordCB'><tt>cupsSetPasswordCB()</tt></a> </li>
191 <li><a href='#cupsSetServer'><tt>cupsSetServer()</tt></a> </li>
192 <li><a href='#cupsSetUser'><tt>cupsSetUser()</tt></a> </li>
193 <li><a href='#cupsTempFd'><tt>cupsTempFd()</tt></a> </li>
194 <li><a href='#cupsTempFile'><tt>cupsTempFile()</tt></a> <span class='info'>&nbsp;DEPRECATED&nbsp;</span></li>
195 <li><a href='#cupsTempFile2'><tt>cupsTempFile2()</tt></a> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></li>
196 <li><a href='#cupsUser'><tt>cupsUser()</tt></a> </li>
197</ul>
198<!-- NEW PAGE -->
199<h3 class='title'><a name='cupsAddDest'>cupsAddDest()</a></h3>
200<h4>Description</h4>
201<p>Add a destination to the list of destinations.
bc44d920 202<p>This function cannot be used to add a new class or printer queue,
2abf387c 203it only adds a new container of saved options for the named
204destination or instance.
bc44d920 205<p>If the named destination already exists, the destination list is
2abf387c 206returned unchanged. Adding a new instance of a destination creates
207a copy of that destination's options.
bc44d920 208<p>Use the cupsSaveDests() function to save the updated list of
209destinations to the user's lpoptions file.
ef416fc2 210<h4>Syntax</h4>
bc44d920 211<p><tt>
212int<br>
ef416fc2 213cupsAddDest(
ecdc0628 214 const char * name,
215 const char * instance,
ef416fc2 216 int num_dests,
217 <a href='#cups_dest_t'>cups_dest_t</a> ** dests);
bc44d920 218</tt></p>
ef416fc2 219<h4>Arguments</h4>
bc44d920 220<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 221<thead><tr><th>Name</th><th>Description</th></tr></thead>
222<tbody>
2abf387c 223<tr><td><tt>name</tt></td><td>Destination name</td></tr>
224<tr><td><tt>instance</tt></td><td>Instance name or NULL for none/primary</td></tr>
ef416fc2 225<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
226<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
227</tbody></table></div>
228<h4>Returns</h4>
229<p>New number of destinations</p>
230<!-- NEW PAGE -->
231<h3 class='title'><a name='cupsAddOption'>cupsAddOption()</a></h3>
232<h4>Description</h4>
bc44d920 233<p>Add an option to an option array.
ef416fc2 234<h4>Syntax</h4>
bc44d920 235<p><tt>
236int<br>
ef416fc2 237cupsAddOption(
ecdc0628 238 const char * name,
239 const char * value,
ef416fc2 240 int num_options,
241 <a href='#cups_option_t'>cups_option_t</a> ** options);
bc44d920 242</tt></p>
ef416fc2 243<h4>Arguments</h4>
bc44d920 244<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 245<thead><tr><th>Name</th><th>Description</th></tr></thead>
246<tbody>
247<tr><td><tt>name</tt></td><td>Name of option</td></tr>
248<tr><td><tt>value</tt></td><td>Value of option</td></tr>
249<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
250<tr><td><tt>options</tt></td><td>Pointer to options</td></tr>
251</tbody></table></div>
252<h4>Returns</h4>
253<p>Number of options</p>
254<!-- NEW PAGE -->
255<h3 class='title'><a name='cupsCancelJob'>cupsCancelJob()</a></h3>
256<h4>Description</h4>
257<p>Cancel a print job on the default server.
bc44d920 258<p>Use the cupsLastError() and cupsLastErrorString() functions to get
259the cause of any failure.
ef416fc2 260<h4>Syntax</h4>
bc44d920 261<p><tt>
262int<br>
ef416fc2 263cupsCancelJob(
ecdc0628 264 const char * name,
ef416fc2 265 int job);
bc44d920 266</tt></p>
ef416fc2 267<h4>Arguments</h4>
bc44d920 268<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 269<thead><tr><th>Name</th><th>Description</th></tr></thead>
270<tbody>
271<tr><td><tt>name</tt></td><td>Name of printer or class</td></tr>
272<tr><td><tt>job</tt></td><td>Job ID</td></tr>
273</tbody></table></div>
274<h4>Returns</h4>
275<p>1 on success, 0 on failure</p>
276<!-- NEW PAGE -->
ef416fc2 277<h3 class='title'><a name='cupsEncryption'>cupsEncryption()</a></h3>
278<h4>Description</h4>
279<p>Get the default encryption settings.
bc44d920 280<p>The default encryption setting comes from the CUPS_ENCRYPTION
ef416fc2 281environment variable, then the ~/.cupsrc file, and finally the
282/etc/cups/client.conf file. If not set, the default is
bc44d920 283HTTP_ENCRYPT_IF_REQUESTED.
ef416fc2 284<h4>Syntax</h4>
bc44d920 285<p><tt>
286http_encryption_t<br>
ef416fc2 287cupsEncryption(void);
bc44d920 288</tt></p>
ef416fc2 289<h4>Arguments</h4>
290<p>None.</p>
291<h4>Returns</h4>
292<p>Encryption settings</p>
293<!-- NEW PAGE -->
294<h3 class='title'><a name='cupsFreeDests'>cupsFreeDests()</a></h3>
295<h4>Description</h4>
bc44d920 296<p>Free the memory used by the list of destinations.
ef416fc2 297<h4>Syntax</h4>
bc44d920 298<p><tt>
299void<br>
ef416fc2 300cupsFreeDests(
301 int num_dests,
302 <a href='#cups_dest_t'>cups_dest_t</a> * dests);
bc44d920 303</tt></p>
ef416fc2 304<h4>Arguments</h4>
bc44d920 305<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 306<thead><tr><th>Name</th><th>Description</th></tr></thead>
307<tbody>
308<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
309<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
310</tbody></table></div>
311<h4>Returns</h4>
312<p>Nothing.</p>
313<!-- NEW PAGE -->
314<h3 class='title'><a name='cupsFreeJobs'>cupsFreeJobs()</a></h3>
315<h4>Description</h4>
bc44d920 316<p>Free memory used by job data.
ef416fc2 317<h4>Syntax</h4>
bc44d920 318<p><tt>
319void<br>
ef416fc2 320cupsFreeJobs(
321 int num_jobs,
322 <a href='#cups_job_t'>cups_job_t</a> * jobs);
bc44d920 323</tt></p>
ef416fc2 324<h4>Arguments</h4>
bc44d920 325<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 326<thead><tr><th>Name</th><th>Description</th></tr></thead>
327<tbody>
328<tr><td><tt>num_jobs</tt></td><td>Number of jobs</td></tr>
329<tr><td><tt>jobs</tt></td><td>Jobs</td></tr>
330</tbody></table></div>
331<h4>Returns</h4>
332<p>Nothing.</p>
333<!-- NEW PAGE -->
334<h3 class='title'><a name='cupsFreeOptions'>cupsFreeOptions()</a></h3>
335<h4>Description</h4>
bc44d920 336<p>Free all memory used by options.
ef416fc2 337<h4>Syntax</h4>
bc44d920 338<p><tt>
339void<br>
ef416fc2 340cupsFreeOptions(
341 int num_options,
342 <a href='#cups_option_t'>cups_option_t</a> * options);
bc44d920 343</tt></p>
ef416fc2 344<h4>Arguments</h4>
bc44d920 345<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 346<thead><tr><th>Name</th><th>Description</th></tr></thead>
347<tbody>
348<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
349<tr><td><tt>options</tt></td><td>Pointer to options</td></tr>
350</tbody></table></div>
351<h4>Returns</h4>
352<p>Nothing.</p>
353<!-- NEW PAGE -->
354<h3 class='title'><span class='info'>&nbsp;DEPRECATED&nbsp;</span><a name='cupsGetClasses'>cupsGetClasses()</a></h3>
355<h4>Description</h4>
356<p>Get a list of printer classes from the default server.
bc44d920 357<p>This function is deprecated - use cupsGetDests() instead.
ef416fc2 358
ef416fc2 359
ef416fc2 360<h4>Syntax</h4>
bc44d920 361<p><tt>
362int<br>
ef416fc2 363cupsGetClasses(
ecdc0628 364 char *** classes);
bc44d920 365</tt></p>
ef416fc2 366<h4>Arguments</h4>
bc44d920 367<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 368<thead><tr><th>Name</th><th>Description</th></tr></thead>
369<tbody>
370<tr><td><tt>classes</tt></td><td>Classes</td></tr>
371</tbody></table></div>
372<h4>Returns</h4>
373<p>Number of classes</p>
374<!-- NEW PAGE -->
375<h3 class='title'><a name='cupsGetDefault'>cupsGetDefault()</a></h3>
376<h4>Description</h4>
377<p>Get the default printer or class for the default server.
bc44d920 378<p>This function returns the default printer or class as defined by
ef416fc2 379the LPDEST or PRINTER environment variables. If these environment
380variables are not set, the server default destination is returned.
381Applications should use the cupsGetDests() and cupsGetDest() functions
382to get the user-defined default printer, as this function does not
bc44d920 383support the lpoptions-defined default printer.
ef416fc2 384<h4>Syntax</h4>
bc44d920 385<p><tt>
386const char *<br>
ef416fc2 387cupsGetDefault(void);
bc44d920 388</tt></p>
ef416fc2 389<h4>Arguments</h4>
390<p>None.</p>
391<h4>Returns</h4>
392<p>Default printer or NULL</p>
393<!-- NEW PAGE -->
394<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span><a name='cupsGetDefault2'>cupsGetDefault2()</a></h3>
395<h4>Description</h4>
396<p>Get the default printer or class for the specified server.
bc44d920 397<p>This function returns the default printer or class as defined by
ef416fc2 398the LPDEST or PRINTER environment variables. If these environment
399variables are not set, the server default destination is returned.
400Applications should use the cupsGetDests() and cupsGetDest() functions
401to get the user-defined default printer, as this function does not
402support the lpoptions-defined default printer.
403
bc44d920 404
ef416fc2 405<h4>Syntax</h4>
bc44d920 406<p><tt>
407const char *<br>
ef416fc2 408cupsGetDefault2(
409 http_t * http);
bc44d920 410</tt></p>
ef416fc2 411<h4>Arguments</h4>
bc44d920 412<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 413<thead><tr><th>Name</th><th>Description</th></tr></thead>
414<tbody>
415<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
416</tbody></table></div>
417<h4>Returns</h4>
418<p>Default printer or NULL</p>
419<!-- NEW PAGE -->
420<h3 class='title'><a name='cupsGetDest'>cupsGetDest()</a></h3>
421<h4>Description</h4>
422<p>Get the named destination from the list.
bc44d920 423<p>Use the cupsGetDests() or cupsGetDests2() functions to get a
424list of supported destinations for the current user.
ef416fc2 425<h4>Syntax</h4>
bc44d920 426<p><tt>
427<a href='#cups_dest_t'>cups_dest_t</a> *<br>
ef416fc2 428cupsGetDest(
ecdc0628 429 const char * name,
430 const char * instance,
ef416fc2 431 int num_dests,
432 <a href='#cups_dest_t'>cups_dest_t</a> * dests);
bc44d920 433</tt></p>
ef416fc2 434<h4>Arguments</h4>
bc44d920 435<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 436<thead><tr><th>Name</th><th>Description</th></tr></thead>
437<tbody>
2abf387c 438<tr><td><tt>name</tt></td><td>Destination name or NULL for the default destination</td></tr>
439<tr><td><tt>instance</tt></td><td>Instance name or NULL</td></tr>
ef416fc2 440<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
441<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
442</tbody></table></div>
443<h4>Returns</h4>
444<p>Destination pointer or NULL</p>
445<!-- NEW PAGE -->
446<h3 class='title'><a name='cupsGetDests'>cupsGetDests()</a></h3>
447<h4>Description</h4>
ecdc0628 448<p>Get the list of destinations from the default server.
bc44d920 449<p>Starting with CUPS 1.2, the returned list of destinations include the
ecdc0628 450printer-info, printer-is-accepting-jobs, printer-is-shared,
451printer-make-and-model, printer-state, printer-state-change-time,
2abf387c 452printer-state-reasons, and printer-type attributes as options.
bc44d920 453<p>Use the cupsFreeDests() function to free the destination list and
454the cupsGetDest() function to find a particular destination.
ef416fc2 455<h4>Syntax</h4>
bc44d920 456<p><tt>
457int<br>
ef416fc2 458cupsGetDests(
459 <a href='#cups_dest_t'>cups_dest_t</a> ** dests);
bc44d920 460</tt></p>
ef416fc2 461<h4>Arguments</h4>
bc44d920 462<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 463<thead><tr><th>Name</th><th>Description</th></tr></thead>
464<tbody>
465<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
466</tbody></table></div>
467<h4>Returns</h4>
468<p>Number of destinations</p>
469<!-- NEW PAGE -->
470<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span><a name='cupsGetDests2'>cupsGetDests2()</a></h3>
471<h4>Description</h4>
472<p>Get the list of destinations from the specified server.
bc44d920 473<p>Starting with CUPS 1.2, the returned list of destinations include the
ecdc0628 474printer-info, printer-is-accepting-jobs, printer-is-shared,
475printer-make-and-model, printer-state, printer-state-change-time,
476printer-state-reasons, and printer-type attributes as options.
bc44d920 477<p>Use the cupsFreeDests() function to free the destination list and
2abf387c 478the cupsGetDest() function to find a particular destination.
479
bc44d920 480
ef416fc2 481<h4>Syntax</h4>
bc44d920 482<p><tt>
483int<br>
ef416fc2 484cupsGetDests2(
485 http_t * http,
486 <a href='#cups_dest_t'>cups_dest_t</a> ** dests);
bc44d920 487</tt></p>
ef416fc2 488<h4>Arguments</h4>
bc44d920 489<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 490<thead><tr><th>Name</th><th>Description</th></tr></thead>
491<tbody>
492<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
493<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
494</tbody></table></div>
495<h4>Returns</h4>
496<p>Number of destinations</p>
497<!-- NEW PAGE -->
498<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.20&nbsp;</span><a name='cupsGetFd'>cupsGetFd()</a></h3>
499<h4>Description</h4>
500<p>Get a file from the server.
bc44d920 501<p>This function returns HTTP_OK when the file is successfully retrieved.
ef416fc2 502
ef416fc2 503
ef416fc2 504<h4>Syntax</h4>
bc44d920 505<p><tt>
506http_status_t<br>
ef416fc2 507cupsGetFd(
508 http_t * http,
ecdc0628 509 const char * resource,
ef416fc2 510 int fd);
bc44d920 511</tt></p>
ef416fc2 512<h4>Arguments</h4>
bc44d920 513<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 514<thead><tr><th>Name</th><th>Description</th></tr></thead>
515<tbody>
516<tr><td><tt>http</tt></td><td>HTTP connection to server</td></tr>
517<tr><td><tt>resource</tt></td><td>Resource name</td></tr>
518<tr><td><tt>fd</tt></td><td>File descriptor</td></tr>
519</tbody></table></div>
520<h4>Returns</h4>
ecdc0628 521<p>HTTP status</p>
ef416fc2 522<!-- NEW PAGE -->
523<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.20&nbsp;</span><a name='cupsGetFile'>cupsGetFile()</a></h3>
524<h4>Description</h4>
525<p>Get a file from the server.
bc44d920 526<p>This function returns HTTP_OK when the file is successfully retrieved.
ef416fc2 527
ef416fc2 528
ef416fc2 529<h4>Syntax</h4>
bc44d920 530<p><tt>
531http_status_t<br>
ef416fc2 532cupsGetFile(
533 http_t * http,
ecdc0628 534 const char * resource,
535 const char * filename);
bc44d920 536</tt></p>
ef416fc2 537<h4>Arguments</h4>
bc44d920 538<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 539<thead><tr><th>Name</th><th>Description</th></tr></thead>
540<tbody>
541<tr><td><tt>http</tt></td><td>HTTP connection to server</td></tr>
542<tr><td><tt>resource</tt></td><td>Resource name</td></tr>
543<tr><td><tt>filename</tt></td><td>Filename</td></tr>
544</tbody></table></div>
545<h4>Returns</h4>
ecdc0628 546<p>HTTP status</p>
ef416fc2 547<!-- NEW PAGE -->
548<h3 class='title'><a name='cupsGetJobs'>cupsGetJobs()</a></h3>
549<h4>Description</h4>
bc44d920 550<p>Get the jobs from the default server.
ef416fc2 551<h4>Syntax</h4>
bc44d920 552<p><tt>
553int<br>
ef416fc2 554cupsGetJobs(
555 <a href='#cups_job_t'>cups_job_t</a> ** jobs,
ecdc0628 556 const char * mydest,
ef416fc2 557 int myjobs,
558 int completed);
bc44d920 559</tt></p>
ef416fc2 560<h4>Arguments</h4>
bc44d920 561<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 562<thead><tr><th>Name</th><th>Description</th></tr></thead>
563<tbody>
564<tr><td><tt>jobs</tt></td><td>Job data</td></tr>
ecdc0628 565<tr><td><tt>mydest</tt></td><td>NULL = all destinations, *
566otherwise show jobs for mydest</td></tr>
567<tr><td><tt>myjobs</tt></td><td>0 = all users, 1 = mine</td></tr>
568<tr><td><tt>completed</tt></td><td>-1 = show all, 0 = active, *
5691 = completed jobs</td></tr>
ef416fc2 570</tbody></table></div>
571<h4>Returns</h4>
572<p>Number of jobs</p>
573<!-- NEW PAGE -->
574<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span><a name='cupsGetJobs2'>cupsGetJobs2()</a></h3>
575<h4>Description</h4>
576<p>Get the jobs from the specified server.
577
bc44d920 578
ef416fc2 579<h4>Syntax</h4>
bc44d920 580<p><tt>
581int<br>
ef416fc2 582cupsGetJobs2(
583 http_t * http,
584 <a href='#cups_job_t'>cups_job_t</a> ** jobs,
ecdc0628 585 const char * mydest,
ef416fc2 586 int myjobs,
587 int completed);
bc44d920 588</tt></p>
ef416fc2 589<h4>Arguments</h4>
bc44d920 590<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 591<thead><tr><th>Name</th><th>Description</th></tr></thead>
592<tbody>
593<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
594<tr><td><tt>jobs</tt></td><td>Job data</td></tr>
ecdc0628 595<tr><td><tt>mydest</tt></td><td>NULL = all destinations, *
596otherwise show jobs for mydest</td></tr>
597<tr><td><tt>myjobs</tt></td><td>0 = all users, 1 = mine</td></tr>
598<tr><td><tt>completed</tt></td><td>-1 = show all, 0 = active, *
5991 = completed jobs</td></tr>
ef416fc2 600</tbody></table></div>
601<h4>Returns</h4>
602<p>Number of jobs</p>
603<!-- NEW PAGE -->
604<h3 class='title'><a name='cupsGetOption'>cupsGetOption()</a></h3>
605<h4>Description</h4>
bc44d920 606<p>Get an option value.
ef416fc2 607<h4>Syntax</h4>
bc44d920 608<p><tt>
609const char *<br>
ef416fc2 610cupsGetOption(
ecdc0628 611 const char * name,
ef416fc2 612 int num_options,
613 <a href='#cups_option_t'>cups_option_t</a> * options);
bc44d920 614</tt></p>
ef416fc2 615<h4>Arguments</h4>
bc44d920 616<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 617<thead><tr><th>Name</th><th>Description</th></tr></thead>
618<tbody>
619<tr><td><tt>name</tt></td><td>Name of option</td></tr>
620<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
621<tr><td><tt>options</tt></td><td>Options</td></tr>
622</tbody></table></div>
623<h4>Returns</h4>
624<p>Option value or NULL</p>
625<!-- NEW PAGE -->
626<h3 class='title'><a name='cupsGetPPD'>cupsGetPPD()</a></h3>
627<h4>Description</h4>
628<p>Get the PPD file for a printer on the default server.
bc44d920 629<p>For classes, cupsGetPPD() returns the PPD file for the first printer
630in the class.
ef416fc2 631<h4>Syntax</h4>
bc44d920 632<p><tt>
633const char *<br>
ef416fc2 634cupsGetPPD(
ecdc0628 635 const char * name);
bc44d920 636</tt></p>
ef416fc2 637<h4>Arguments</h4>
bc44d920 638<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 639<thead><tr><th>Name</th><th>Description</th></tr></thead>
640<tbody>
641<tr><td><tt>name</tt></td><td>Printer name</td></tr>
642</tbody></table></div>
643<h4>Returns</h4>
644<p>Filename for PPD file</p>
645<!-- NEW PAGE -->
646<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span><a name='cupsGetPPD2'>cupsGetPPD2()</a></h3>
647<h4>Description</h4>
648<p>Get the PPD file for a printer from the specified server.
bc44d920 649<p>For classes, cupsGetPPD2() returns the PPD file for the first printer
ef416fc2 650in the class.
651
bc44d920 652
ef416fc2 653<h4>Syntax</h4>
bc44d920 654<p><tt>
655const char *<br>
ef416fc2 656cupsGetPPD2(
657 http_t * http,
ecdc0628 658 const char * name);
bc44d920 659</tt></p>
ef416fc2 660<h4>Arguments</h4>
bc44d920 661<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 662<thead><tr><th>Name</th><th>Description</th></tr></thead>
663<tbody>
664<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
665<tr><td><tt>name</tt></td><td>Printer name</td></tr>
666</tbody></table></div>
667<h4>Returns</h4>
668<p>Filename for PPD file</p>
669<!-- NEW PAGE -->
670<h3 class='title'><a name='cupsGetPassword'>cupsGetPassword()</a></h3>
671<h4>Description</h4>
672<p>Get a password from the user.
bc44d920 673<p>Uses the current password callback function. Returns NULL if the
674user does not provide a password.
ef416fc2 675<h4>Syntax</h4>
bc44d920 676<p><tt>
677const char *<br>
ef416fc2 678cupsGetPassword(
ecdc0628 679 const char * prompt);
bc44d920 680</tt></p>
ef416fc2 681<h4>Arguments</h4>
bc44d920 682<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 683<thead><tr><th>Name</th><th>Description</th></tr></thead>
684<tbody>
685<tr><td><tt>prompt</tt></td><td>Prompt string</td></tr>
686</tbody></table></div>
687<h4>Returns</h4>
688<p>Password</p>
689<!-- NEW PAGE -->
690<h3 class='title'><span class='info'>&nbsp;DEPRECATED&nbsp;</span><a name='cupsGetPrinters'>cupsGetPrinters()</a></h3>
691<h4>Description</h4>
692<p>Get a list of printers from the default server.
bc44d920 693<p>This function is deprecated - use cupsGetDests() instead.
ef416fc2 694
ef416fc2 695
ef416fc2 696<h4>Syntax</h4>
bc44d920 697<p><tt>
698int<br>
ef416fc2 699cupsGetPrinters(
ecdc0628 700 char *** printers);
bc44d920 701</tt></p>
ef416fc2 702<h4>Arguments</h4>
bc44d920 703<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 704<thead><tr><th>Name</th><th>Description</th></tr></thead>
705<tbody>
706<tr><td><tt>printers</tt></td><td>Printers</td></tr>
707</tbody></table></div>
708<h4>Returns</h4>
709<p>Number of printers</p>
710<!-- NEW PAGE -->
bc44d920 711<h3 class='title'><span class='info'>&nbsp;CUPS 1.3&nbsp;</span><a name='cupsGetServerPPD'>cupsGetServerPPD()</a></h3>
712<h4>Description</h4>
713<p>Get an available PPD file from the server.
714<p>This function returns the named PPD file from the server. The
715list of available PPDs is provided by the IPP CUPS_GET_PPDS
716operation.
717<p>You must remove (unlink) the PPD file when you are finished with
718it. The PPD filename is stored in a static location that will be
719overwritten on the next call to cupsGetPPD(), cupsGetPPD2(), or
720cupsGetServerPPD().
721
722
723<h4>Syntax</h4>
724<p><tt>
725char *<br>
726cupsGetServerPPD(
727 http_t * http,
728 const char * name);
729</tt></p>
730<h4>Arguments</h4>
731<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
732<thead><tr><th>Name</th><th>Description</th></tr></thead>
733<tbody>
734<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
735<tr><td><tt>name</tt></td><td>Name of PPD file (&quot;ppd-name&quot;)</td></tr>
736</tbody></table></div>
737<h4>Returns</h4>
738<p>Name of PPD file or NULL on error</p>
739<!-- NEW PAGE -->
ef416fc2 740<h3 class='title'><a name='cupsLangDefault'>cupsLangDefault()</a></h3>
741<h4>Description</h4>
bc44d920 742<p>Return the default language.
ef416fc2 743<h4>Syntax</h4>
bc44d920 744<p><tt>
745cups_lang_t *<br>
ef416fc2 746cupsLangDefault(void);
bc44d920 747</tt></p>
ef416fc2 748<h4>Arguments</h4>
749<p>None.</p>
750<h4>Returns</h4>
751<p>Language data</p>
752<!-- NEW PAGE -->
753<h3 class='title'><a name='cupsLangEncoding'>cupsLangEncoding()</a></h3>
754<h4>Description</h4>
755<p>Return the character encoding (us-ascii, etc.)
bc44d920 756for the given language.
ef416fc2 757<h4>Syntax</h4>
bc44d920 758<p><tt>
759const char *<br>
ef416fc2 760cupsLangEncoding(
761 cups_lang_t * lang);
bc44d920 762</tt></p>
ef416fc2 763<h4>Arguments</h4>
bc44d920 764<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 765<thead><tr><th>Name</th><th>Description</th></tr></thead>
766<tbody>
767<tr><td><tt>lang</tt></td><td>Language data</td></tr>
768</tbody></table></div>
769<h4>Returns</h4>
770<p>Character encoding</p>
771<!-- NEW PAGE -->
772<h3 class='title'><a name='cupsLangFlush'>cupsLangFlush()</a></h3>
773<h4>Description</h4>
bc44d920 774<p>Flush all language data out of the cache.
ef416fc2 775<h4>Syntax</h4>
bc44d920 776<p><tt>
777void<br>
ef416fc2 778cupsLangFlush(void);
bc44d920 779</tt></p>
ef416fc2 780<h4>Arguments</h4>
781<p>None.</p>
782<h4>Returns</h4>
783<p>Nothing.</p>
784<!-- NEW PAGE -->
785<h3 class='title'><a name='cupsLangFree'>cupsLangFree()</a></h3>
786<h4>Description</h4>
787<p>Free language data.
bc44d920 788<p>This does not actually free anything; use cupsLangFlush() for that.
ef416fc2 789<h4>Syntax</h4>
bc44d920 790<p><tt>
791void<br>
ef416fc2 792cupsLangFree(
793 cups_lang_t * lang);
bc44d920 794</tt></p>
ef416fc2 795<h4>Arguments</h4>
bc44d920 796<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 797<thead><tr><th>Name</th><th>Description</th></tr></thead>
798<tbody>
799<tr><td><tt>lang</tt></td><td>Language to free</td></tr>
800</tbody></table></div>
801<h4>Returns</h4>
802<p>Nothing.</p>
803<!-- NEW PAGE -->
804<h3 class='title'><a name='cupsLangGet'>cupsLangGet()</a></h3>
805<h4>Description</h4>
bc44d920 806<p>Get a language.
ef416fc2 807<h4>Syntax</h4>
bc44d920 808<p><tt>
809cups_lang_t *<br>
ef416fc2 810cupsLangGet(
ecdc0628 811 const char * language);
bc44d920 812</tt></p>
ef416fc2 813<h4>Arguments</h4>
bc44d920 814<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 815<thead><tr><th>Name</th><th>Description</th></tr></thead>
816<tbody>
817<tr><td><tt>language</tt></td><td>Language or locale</td></tr>
818</tbody></table></div>
819<h4>Returns</h4>
820<p>Language data</p>
821<!-- NEW PAGE -->
822<h3 class='title'><a name='cupsLastError'>cupsLastError()</a></h3>
823<h4>Description</h4>
bc44d920 824<p>Return the last IPP status code.
ef416fc2 825<h4>Syntax</h4>
bc44d920 826<p><tt>
827ipp_status_t<br>
ef416fc2 828cupsLastError(void);
bc44d920 829</tt></p>
ef416fc2 830<h4>Arguments</h4>
831<p>None.</p>
832<h4>Returns</h4>
833<p>IPP status code from last request</p>
834<!-- NEW PAGE -->
835<h3 class='title'><span class='info'>&nbsp;CUPS 1.2&nbsp;</span><a name='cupsLastErrorString'>cupsLastErrorString()</a></h3>
836<h4>Description</h4>
837<p>Return the last IPP status-message.
838
bc44d920 839
ef416fc2 840<h4>Syntax</h4>
bc44d920 841<p><tt>
842const char *<br>
ef416fc2 843cupsLastErrorString(void);
bc44d920 844</tt></p>
ef416fc2 845<h4>Arguments</h4>
846<p>None.</p>
847<h4>Returns</h4>
848<p>status-message text from last request</p>
849<!-- NEW PAGE -->
850<h3 class='title'><a name='cupsMarkOptions'>cupsMarkOptions()</a></h3>
851<h4>Description</h4>
bc44d920 852<p>Mark command-line options in a PPD file.
ef416fc2 853<h4>Syntax</h4>
bc44d920 854<p><tt>
855int<br>
ef416fc2 856cupsMarkOptions(
857 ppd_file_t * ppd,
858 int num_options,
859 <a href='#cups_option_t'>cups_option_t</a> * options);
bc44d920 860</tt></p>
ef416fc2 861<h4>Arguments</h4>
bc44d920 862<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 863<thead><tr><th>Name</th><th>Description</th></tr></thead>
864<tbody>
865<tr><td><tt>ppd</tt></td><td>PPD file</td></tr>
866<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
867<tr><td><tt>options</tt></td><td>Options</td></tr>
868</tbody></table></div>
869<h4>Returns</h4>
870<p>1 if conflicting</p>
871<!-- NEW PAGE -->
bc44d920 872<h3 class='title'><span class='info'>&nbsp;CUPS 1.2&nbsp;</span><a name='cupsNotifySubject'>cupsNotifySubject()</a></h3>
873<h4>Description</h4>
874<p>Return the subject for the given notification message.
875<p>The returned string must be freed by the caller using free().
876
877
878<h4>Syntax</h4>
879<p><tt>
880char *<br>
881cupsNotifySubject(
882 cups_lang_t * lang,
883 ipp_t * event);
884</tt></p>
885<h4>Arguments</h4>
886<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
887<thead><tr><th>Name</th><th>Description</th></tr></thead>
888<tbody>
889<tr><td><tt>lang</tt></td><td>Language data</td></tr>
890<tr><td><tt>event</tt></td><td>Event data</td></tr>
891</tbody></table></div>
892<h4>Returns</h4>
893<p>Subject string or NULL</p>
894<!-- NEW PAGE -->
895<h3 class='title'><span class='info'>&nbsp;CUPS 1.2&nbsp;</span><a name='cupsNotifyText'>cupsNotifyText()</a></h3>
896<h4>Description</h4>
897<p>Return the text for the given notification message.
898<p>The returned string must be freed by the caller using free().
899
900
901<h4>Syntax</h4>
902<p><tt>
903char *<br>
904cupsNotifyText(
905 cups_lang_t * lang,
906 ipp_t * event);
907</tt></p>
908<h4>Arguments</h4>
909<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
910<thead><tr><th>Name</th><th>Description</th></tr></thead>
911<tbody>
912<tr><td><tt>lang</tt></td><td>Language data</td></tr>
913<tr><td><tt>event</tt></td><td>Event data</td></tr>
914</tbody></table></div>
915<h4>Returns</h4>
916<p>Message text or NULL</p>
917<!-- NEW PAGE -->
ef416fc2 918<h3 class='title'><a name='cupsParseOptions'>cupsParseOptions()</a></h3>
919<h4>Description</h4>
920<p>Parse options from a command-line argument.
bc44d920 921<p>This function converts space-delimited name/value pairs according
ef416fc2 922to the PAPI text option ABNF specification. Collection values
923(&quot;name={a=... b=... c=...}&quot;) are stored with the curley brackets
924intact - use cupsParseOptions() on the value to extract the collection
bc44d920 925attributes.
ef416fc2 926<h4>Syntax</h4>
bc44d920 927<p><tt>
928int<br>
ef416fc2 929cupsParseOptions(
ecdc0628 930 const char * arg,
ef416fc2 931 int num_options,
932 <a href='#cups_option_t'>cups_option_t</a> ** options);
bc44d920 933</tt></p>
ef416fc2 934<h4>Arguments</h4>
bc44d920 935<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 936<thead><tr><th>Name</th><th>Description</th></tr></thead>
937<tbody>
938<tr><td><tt>arg</tt></td><td>Argument to parse</td></tr>
939<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
940<tr><td><tt>options</tt></td><td>Options found</td></tr>
941</tbody></table></div>
942<h4>Returns</h4>
943<p>Number of options found</p>
944<!-- NEW PAGE -->
945<h3 class='title'><a name='cupsPrintFile'>cupsPrintFile()</a></h3>
946<h4>Description</h4>
bc44d920 947<p>Print a file to a printer or class on the default server.
ef416fc2 948<h4>Syntax</h4>
bc44d920 949<p><tt>
950int<br>
ef416fc2 951cupsPrintFile(
ecdc0628 952 const char * name,
953 const char * filename,
954 const char * title,
ef416fc2 955 int num_options,
956 <a href='#cups_option_t'>cups_option_t</a> * options);
bc44d920 957</tt></p>
ef416fc2 958<h4>Arguments</h4>
bc44d920 959<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 960<thead><tr><th>Name</th><th>Description</th></tr></thead>
961<tbody>
962<tr><td><tt>name</tt></td><td>Printer or class name</td></tr>
963<tr><td><tt>filename</tt></td><td>File to print</td></tr>
964<tr><td><tt>title</tt></td><td>Title of job</td></tr>
965<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
966<tr><td><tt>options</tt></td><td>Options</td></tr>
967</tbody></table></div>
968<h4>Returns</h4>
969<p>Job ID</p>
970<!-- NEW PAGE -->
971<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span><a name='cupsPrintFile2'>cupsPrintFile2()</a></h3>
972<h4>Description</h4>
973<p>Print a file to a printer or class on the specified server.
974
bc44d920 975
ef416fc2 976<h4>Syntax</h4>
bc44d920 977<p><tt>
978int<br>
ef416fc2 979cupsPrintFile2(
980 http_t * http,
ecdc0628 981 const char * name,
982 const char * filename,
983 const char * title,
ef416fc2 984 int num_options,
985 <a href='#cups_option_t'>cups_option_t</a> * options);
bc44d920 986</tt></p>
ef416fc2 987<h4>Arguments</h4>
bc44d920 988<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 989<thead><tr><th>Name</th><th>Description</th></tr></thead>
990<tbody>
991<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
992<tr><td><tt>name</tt></td><td>Printer or class name</td></tr>
993<tr><td><tt>filename</tt></td><td>File to print</td></tr>
994<tr><td><tt>title</tt></td><td>Title of job</td></tr>
995<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
996<tr><td><tt>options</tt></td><td>Options</td></tr>
997</tbody></table></div>
998<h4>Returns</h4>
999<p>Job ID</p>
1000<!-- NEW PAGE -->
1001<h3 class='title'><a name='cupsPrintFiles'>cupsPrintFiles()</a></h3>
1002<h4>Description</h4>
ecdc0628 1003<p>Print one or more files to a printer or class on the
bc44d920 1004default server.
ef416fc2 1005<h4>Syntax</h4>
bc44d920 1006<p><tt>
1007int<br>
ef416fc2 1008cupsPrintFiles(
ecdc0628 1009 const char * name,
ef416fc2 1010 int num_files,
ecdc0628 1011 const char ** files,
1012 const char * title,
ef416fc2 1013 int num_options,
1014 <a href='#cups_option_t'>cups_option_t</a> * options);
bc44d920 1015</tt></p>
ef416fc2 1016<h4>Arguments</h4>
bc44d920 1017<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1018<thead><tr><th>Name</th><th>Description</th></tr></thead>
1019<tbody>
1020<tr><td><tt>name</tt></td><td>Printer or class name</td></tr>
1021<tr><td><tt>num_files</tt></td><td>Number of files</td></tr>
1022<tr><td><tt>files</tt></td><td>File(s) to print</td></tr>
1023<tr><td><tt>title</tt></td><td>Title of job</td></tr>
1024<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
1025<tr><td><tt>options</tt></td><td>Options</td></tr>
1026</tbody></table></div>
1027<h4>Returns</h4>
1028<p>Job ID</p>
1029<!-- NEW PAGE -->
1030<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span><a name='cupsPrintFiles2'>cupsPrintFiles2()</a></h3>
1031<h4>Description</h4>
ecdc0628 1032<p>Print one or more files to a printer or class on the
1033specified server.
ef416fc2 1034
bc44d920 1035
ef416fc2 1036<h4>Syntax</h4>
bc44d920 1037<p><tt>
1038int<br>
ef416fc2 1039cupsPrintFiles2(
1040 http_t * http,
ecdc0628 1041 const char * name,
ef416fc2 1042 int num_files,
ecdc0628 1043 const char ** files,
1044 const char * title,
ef416fc2 1045 int num_options,
1046 <a href='#cups_option_t'>cups_option_t</a> * options);
bc44d920 1047</tt></p>
ef416fc2 1048<h4>Arguments</h4>
bc44d920 1049<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1050<thead><tr><th>Name</th><th>Description</th></tr></thead>
1051<tbody>
1052<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
1053<tr><td><tt>name</tt></td><td>Printer or class name</td></tr>
1054<tr><td><tt>num_files</tt></td><td>Number of files</td></tr>
1055<tr><td><tt>files</tt></td><td>File(s) to print</td></tr>
1056<tr><td><tt>title</tt></td><td>Title of job</td></tr>
1057<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
1058<tr><td><tt>options</tt></td><td>Options</td></tr>
1059</tbody></table></div>
1060<h4>Returns</h4>
1061<p>Job ID</p>
1062<!-- NEW PAGE -->
1063<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.20&nbsp;</span><a name='cupsPutFd'>cupsPutFd()</a></h3>
1064<h4>Description</h4>
1065<p>Put a file on the server.
bc44d920 1066<p>This function returns HTTP_CREATED when the file is stored successfully.
ef416fc2 1067
ef416fc2 1068
ef416fc2 1069<h4>Syntax</h4>
bc44d920 1070<p><tt>
1071http_status_t<br>
ef416fc2 1072cupsPutFd(
1073 http_t * http,
ecdc0628 1074 const char * resource,
ef416fc2 1075 int fd);
bc44d920 1076</tt></p>
ef416fc2 1077<h4>Arguments</h4>
bc44d920 1078<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1079<thead><tr><th>Name</th><th>Description</th></tr></thead>
1080<tbody>
1081<tr><td><tt>http</tt></td><td>HTTP connection to server</td></tr>
1082<tr><td><tt>resource</tt></td><td>Resource name</td></tr>
1083<tr><td><tt>fd</tt></td><td>File descriptor</td></tr>
1084</tbody></table></div>
1085<h4>Returns</h4>
ecdc0628 1086<p>HTTP status</p>
ef416fc2 1087<!-- NEW PAGE -->
1088<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.20&nbsp;</span><a name='cupsPutFile'>cupsPutFile()</a></h3>
1089<h4>Description</h4>
1090<p>Put a file on the server.
bc44d920 1091<p>This function returns HTTP_CREATED when the file is stored successfully.
ef416fc2 1092
ef416fc2 1093
ef416fc2 1094<h4>Syntax</h4>
bc44d920 1095<p><tt>
1096http_status_t<br>
ef416fc2 1097cupsPutFile(
1098 http_t * http,
ecdc0628 1099 const char * resource,
1100 const char * filename);
bc44d920 1101</tt></p>
ef416fc2 1102<h4>Arguments</h4>
bc44d920 1103<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1104<thead><tr><th>Name</th><th>Description</th></tr></thead>
1105<tbody>
1106<tr><td><tt>http</tt></td><td>HTTP connection to server</td></tr>
1107<tr><td><tt>resource</tt></td><td>Resource name</td></tr>
1108<tr><td><tt>filename</tt></td><td>Filename</td></tr>
1109</tbody></table></div>
1110<h4>Returns</h4>
ecdc0628 1111<p>HTTP status</p>
ef416fc2 1112<!-- NEW PAGE -->
f7deaa1a 1113<h3 class='title'><span class='info'>&nbsp;CUPS 1.3&nbsp;</span><a name='cupsRemoveDest'>cupsRemoveDest()</a></h3>
1114<h4>Description</h4>
1115<p>Remove a destination from the destination list.
bc44d920 1116<p>Removing a destination/instance does not delete the class or printer
f7deaa1a 1117queue, merely the lpoptions for that destination/instance. Use the
1118cupsSetDests() or cupsSetDests2() functions to save the new options
1119for the user.
1120
bc44d920 1121
f7deaa1a 1122<h4>Syntax</h4>
bc44d920 1123<p><tt>
1124int<br>
f7deaa1a 1125cupsRemoveDest(
1126 const char * name,
1127 const char * instance,
1128 int num_dests,
1129 <a href='#cups_dest_t'>cups_dest_t</a> ** dests);
bc44d920 1130</tt></p>
f7deaa1a 1131<h4>Arguments</h4>
bc44d920 1132<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
f7deaa1a 1133<thead><tr><th>Name</th><th>Description</th></tr></thead>
1134<tbody>
1135<tr><td><tt>name</tt></td><td>Destination name</td></tr>
1136<tr><td><tt>instance</tt></td><td>Instance name or NULL</td></tr>
1137<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
1138<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
1139</tbody></table></div>
1140<h4>Returns</h4>
1141<p>New number of destinations</p>
1142<!-- NEW PAGE -->
80ca4592 1143<h3 class='title'><span class='info'>&nbsp;CUPS 1.2&nbsp;</span><a name='cupsRemoveOption'>cupsRemoveOption()</a></h3>
1144<h4>Description</h4>
1145<p>Remove an option from an option array.
1146
bc44d920 1147
80ca4592 1148<h4>Syntax</h4>
bc44d920 1149<p><tt>
1150int<br>
80ca4592 1151cupsRemoveOption(
1152 const char * name,
1153 int num_options,
1154 <a href='#cups_option_t'>cups_option_t</a> ** options);
bc44d920 1155</tt></p>
80ca4592 1156<h4>Arguments</h4>
bc44d920 1157<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
80ca4592 1158<thead><tr><th>Name</th><th>Description</th></tr></thead>
1159<tbody>
1160<tr><td><tt>name</tt></td><td>Option name</td></tr>
1161<tr><td><tt>num_options</tt></td><td>Current number of options</td></tr>
1162<tr><td><tt>options</tt></td><td>Options</td></tr>
1163</tbody></table></div>
1164<h4>Returns</h4>
1165<p>New number of options</p>
1166<!-- NEW PAGE -->
ef416fc2 1167<h3 class='title'><a name='cupsServer'>cupsServer()</a></h3>
1168<h4>Description</h4>
1169<p>Return the hostname/address of the default server.
bc44d920 1170<p>The returned value can be a fully-qualified hostname, a numeric
1171IPv4 or IPv6 address, or a domain socket pathname.
ef416fc2 1172<h4>Syntax</h4>
bc44d920 1173<p><tt>
1174const char *<br>
ef416fc2 1175cupsServer(void);
bc44d920 1176</tt></p>
ef416fc2 1177<h4>Arguments</h4>
1178<p>None.</p>
1179<h4>Returns</h4>
1180<p>Server name</p>
1181<!-- NEW PAGE -->
f7deaa1a 1182<h3 class='title'><span class='info'>&nbsp;CUPS 1.3&nbsp;</span><a name='cupsSetDefaultDest'>cupsSetDefaultDest()</a></h3>
1183<h4>Description</h4>
1184<p>Set the default destination.
1185
bc44d920 1186
f7deaa1a 1187<h4>Syntax</h4>
bc44d920 1188<p><tt>
1189void<br>
f7deaa1a 1190cupsSetDefaultDest(
1191 const char * name,
1192 const char * instance,
1193 int num_dests,
1194 <a href='#cups_dest_t'>cups_dest_t</a> * dests);
bc44d920 1195</tt></p>
f7deaa1a 1196<h4>Arguments</h4>
bc44d920 1197<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
f7deaa1a 1198<thead><tr><th>Name</th><th>Description</th></tr></thead>
1199<tbody>
1200<tr><td><tt>name</tt></td><td>Destination name</td></tr>
1201<tr><td><tt>instance</tt></td><td>Instance name or NULL</td></tr>
1202<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
1203<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
1204</tbody></table></div>
1205<h4>Returns</h4>
1206<p>Nothing.</p>
1207<!-- NEW PAGE -->
ef416fc2 1208<h3 class='title'><a name='cupsSetDests'>cupsSetDests()</a></h3>
1209<h4>Description</h4>
1210<p>Save the list of destinations for the default server.
bc44d920 1211<p>This function saves the destinations to /etc/cups/lpoptions when run
1212as root and ~/.cups/lpoptions when run as a normal user.
ef416fc2 1213<h4>Syntax</h4>
bc44d920 1214<p><tt>
1215void<br>
ef416fc2 1216cupsSetDests(
1217 int num_dests,
1218 <a href='#cups_dest_t'>cups_dest_t</a> * dests);
bc44d920 1219</tt></p>
ef416fc2 1220<h4>Arguments</h4>
bc44d920 1221<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1222<thead><tr><th>Name</th><th>Description</th></tr></thead>
1223<tbody>
1224<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
1225<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
1226</tbody></table></div>
1227<h4>Returns</h4>
1228<p>Nothing.</p>
1229<!-- NEW PAGE -->
1230<h3 class='title'><span class='info'>&nbsp;CUPS 1.1.21&nbsp;</span><a name='cupsSetDests2'>cupsSetDests2()</a></h3>
1231<h4>Description</h4>
1232<p>Save the list of destinations for the specified server.
bc44d920 1233<p>This function saves the destinations to /etc/cups/lpoptions when run
80ca4592 1234as root and ~/.cups/lpoptions when run as a normal user.
ef416fc2 1235
bc44d920 1236
ef416fc2 1237<h4>Syntax</h4>
bc44d920 1238<p><tt>
1239int<br>
ef416fc2 1240cupsSetDests2(
1241 http_t * http,
1242 int num_dests,
1243 <a href='#cups_dest_t'>cups_dest_t</a> * dests);
bc44d920 1244</tt></p>
ef416fc2 1245<h4>Arguments</h4>
bc44d920 1246<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1247<thead><tr><th>Name</th><th>Description</th></tr></thead>
1248<tbody>
1249<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
1250<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
1251<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
1252</tbody></table></div>
1253<h4>Returns</h4>
1254<p>0 on success, -1 on error</p>
1255<!-- NEW PAGE -->
1256<h3 class='title'><a name='cupsSetEncryption'>cupsSetEncryption()</a></h3>
1257<h4>Description</h4>
bc44d920 1258<p>Set the encryption preference.
ef416fc2 1259<h4>Syntax</h4>
bc44d920 1260<p><tt>
1261void<br>
ef416fc2 1262cupsSetEncryption(
1263 http_encryption_t e);
bc44d920 1264</tt></p>
ef416fc2 1265<h4>Arguments</h4>
bc44d920 1266<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1267<thead><tr><th>Name</th><th>Description</th></tr></thead>
1268<tbody>
1269<tr><td><tt>e</tt></td><td>New encryption preference</td></tr>
1270</tbody></table></div>
1271<h4>Returns</h4>
1272<p>Nothing.</p>
1273<!-- NEW PAGE -->
1274<h3 class='title'><a name='cupsSetPasswordCB'>cupsSetPasswordCB()</a></h3>
1275<h4>Description</h4>
1276<p>Set the password callback for CUPS.
bc44d920 1277<p>Pass NULL to restore the default (console) password callback.
ef416fc2 1278<h4>Syntax</h4>
bc44d920 1279<p><tt>
1280void<br>
ef416fc2 1281cupsSetPasswordCB(
ecdc0628 1282 <a href='#cups_password_cb_t'>cups_password_cb_t</a> cb);
bc44d920 1283</tt></p>
ef416fc2 1284<h4>Arguments</h4>
bc44d920 1285<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1286<thead><tr><th>Name</th><th>Description</th></tr></thead>
1287<tbody>
1288<tr><td><tt>cb</tt></td><td>Callback function</td></tr>
1289</tbody></table></div>
1290<h4>Returns</h4>
1291<p>Nothing.</p>
1292<!-- NEW PAGE -->
1293<h3 class='title'><a name='cupsSetServer'>cupsSetServer()</a></h3>
1294<h4>Description</h4>
1295<p>Set the default server name.
bc44d920 1296<p>The &quot;server&quot; string can be a fully-qualified hostname, a numeric
ef416fc2 1297IPv4 or IPv6 address, or a domain socket pathname. Pass NULL to
bc44d920 1298restore the default server name.
ef416fc2 1299<h4>Syntax</h4>
bc44d920 1300<p><tt>
1301void<br>
ef416fc2 1302cupsSetServer(
ecdc0628 1303 const char * server);
bc44d920 1304</tt></p>
ef416fc2 1305<h4>Arguments</h4>
bc44d920 1306<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1307<thead><tr><th>Name</th><th>Description</th></tr></thead>
1308<tbody>
1309<tr><td><tt>server</tt></td><td>Server name</td></tr>
1310</tbody></table></div>
1311<h4>Returns</h4>
1312<p>Nothing.</p>
1313<!-- NEW PAGE -->
1314<h3 class='title'><a name='cupsSetUser'>cupsSetUser()</a></h3>
1315<h4>Description</h4>
1316<p>Set the default user name.
bc44d920 1317<p>Pass NULL to restore the default user name.
ef416fc2 1318<h4>Syntax</h4>
bc44d920 1319<p><tt>
1320void<br>
ef416fc2 1321cupsSetUser(
ecdc0628 1322 const char * user);
bc44d920 1323</tt></p>
ef416fc2 1324<h4>Arguments</h4>
bc44d920 1325<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1326<thead><tr><th>Name</th><th>Description</th></tr></thead>
1327<tbody>
1328<tr><td><tt>user</tt></td><td>User name</td></tr>
1329</tbody></table></div>
1330<h4>Returns</h4>
1331<p>Nothing.</p>
1332<!-- NEW PAGE -->
1333<h3 class='title'><a name='cupsTempFd'>cupsTempFd()</a></h3>
1334<h4>Description</h4>
2abf387c 1335<p>Creates a temporary file.
bc44d920 1336<p>The temporary filename is returned in the filename buffer.
1337The temporary file is opened for reading and writing.
ef416fc2 1338<h4>Syntax</h4>
bc44d920 1339<p><tt>
1340int<br>
ef416fc2 1341cupsTempFd(
ecdc0628 1342 char * filename,
ef416fc2 1343 int len);
bc44d920 1344</tt></p>
ef416fc2 1345<h4>Arguments</h4>
bc44d920 1346<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1347<thead><tr><th>Name</th><th>Description</th></tr></thead>
1348<tbody>
1349<tr><td><tt>filename</tt></td><td>Pointer to buffer</td></tr>
1350<tr><td><tt>len</tt></td><td>Size of buffer</td></tr>
1351</tbody></table></div>
1352<h4>Returns</h4>
2abf387c 1353<p>New file descriptor or -1 on error</p>
ef416fc2 1354<!-- NEW PAGE -->
1355<h3 class='title'><span class='info'>&nbsp;DEPRECATED&nbsp;</span><a name='cupsTempFile'>cupsTempFile()</a></h3>
1356<h4>Description</h4>
2abf387c 1357<p>Generates a temporary filename.
bc44d920 1358<p>The temporary filename is returned in the filename buffer.
ef416fc2 1359This function is deprecated - use cupsTempFd() or cupsTempFile2()
1360instead.
1361
bc44d920 1362
ef416fc2 1363<h4>Syntax</h4>
bc44d920 1364<p><tt>
1365char *<br>
ef416fc2 1366cupsTempFile(
ecdc0628 1367 char * filename,
ef416fc2 1368 int len);
bc44d920 1369</tt></p>
ef416fc2 1370<h4>Arguments</h4>
bc44d920 1371<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1372<thead><tr><th>Name</th><th>Description</th></tr></thead>
1373<tbody>
1374<tr><td><tt>filename</tt></td><td>Pointer to buffer</td></tr>
1375<tr><td><tt>len</tt></td><td>Size of buffer</td></tr>
1376</tbody></table></div>
1377<h4>Returns</h4>
2abf387c 1378<p>Filename or NULL on error</p>
ef416fc2 1379<!-- NEW PAGE -->
1380<h3 class='title'><span class='info'>&nbsp;CUPS 1.2&nbsp;</span><a name='cupsTempFile2'>cupsTempFile2()</a></h3>
1381<h4>Description</h4>
2abf387c 1382<p>Creates a temporary CUPS file.
bc44d920 1383<p>The temporary filename is returned in the filename buffer.
2abf387c 1384The temporary file is opened for writing.
ef416fc2 1385
bc44d920 1386
ef416fc2 1387<h4>Syntax</h4>
bc44d920 1388<p><tt>
1389cups_file_t *<br>
ef416fc2 1390cupsTempFile2(
ecdc0628 1391 char * filename,
ef416fc2 1392 int len);
bc44d920 1393</tt></p>
ef416fc2 1394<h4>Arguments</h4>
bc44d920 1395<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
ef416fc2 1396<thead><tr><th>Name</th><th>Description</th></tr></thead>
1397<tbody>
1398<tr><td><tt>filename</tt></td><td>Pointer to buffer</td></tr>
1399<tr><td><tt>len</tt></td><td>Size of buffer</td></tr>
1400</tbody></table></div>
1401<h4>Returns</h4>
1402<p>CUPS file or NULL on error</p>
1403<!-- NEW PAGE -->
1404<h3 class='title'><a name='cupsUser'>cupsUser()</a></h3>
1405<h4>Description</h4>
bc44d920 1406<p>Return the current user's name.
ef416fc2 1407<h4>Syntax</h4>
bc44d920 1408<p><tt>
1409const char *<br>
ef416fc2 1410cupsUser(void);
bc44d920 1411</tt></p>
ef416fc2 1412<h4>Arguments</h4>
1413<p>None.</p>
1414<h4>Returns</h4>
1415<p>User name</p>
1416<!-- NEW PAGE -->
1417<h2 class='title'><a name='STRUCTURES'>Structures</a></h2>
1418<ul>
1419 <li><a href='#cups_dest_s'><tt>cups_dest_s</tt></a> </li>
1420 <li><a href='#cups_job_s'><tt>cups_job_s</tt></a> </li>
1421 <li><a href='#cups_option_s'><tt>cups_option_s</tt></a> </li>
1422</ul>
1423<!-- NEW PAGE -->
1424<h3 class='title'><a name='cups_dest_s'>cups_dest_s</a></h3>
1425<h4>Description</h4>
bc44d920 1426<p>Destination
ef416fc2 1427<h4>Definition</h4>
bc44d920 1428<p><tt>
1429struct cups_dest_s<br>
1430{<br>
1431&nbsp;&nbsp;char *name, * instance;<br>
1432&nbsp;&nbsp;int is_default;<br>
1433&nbsp;&nbsp;int num_options;<br>
1434&nbsp;&nbsp;<a href='#cups_option_t'>cups_option_t</a> * options;<br>
1435};</tt></p>
ef416fc2 1436<h4>Members</h4>
bc44d920 1437<div class='table'><table align='center' border='1' width='80%' summary='Members'>
ef416fc2 1438<thead><tr><th>Name</th><th>Description</th></tr></thead>
1439<tbody>
bc44d920 1440<tr><td><tt>instance</tt> </td><td>Local instance name or NULL
1441</td></tr>
1442<tr><td><tt>is_default</tt> </td><td>Is this printer the default?
1443</td></tr>
1444<tr><td><tt>num_options</tt> </td><td>Number of options
1445</td></tr>
1446<tr><td><tt>options</tt> </td><td>Options
1447</td></tr>
ef416fc2 1448</tbody></table></div>
1449<!-- NEW PAGE -->
1450<h3 class='title'><a name='cups_job_s'>cups_job_s</a></h3>
1451<h4>Description</h4>
bc44d920 1452<p>Job
ef416fc2 1453<h4>Definition</h4>
bc44d920 1454<p><tt>
1455struct cups_job_s<br>
1456{<br>
1457&nbsp;&nbsp;time_t completed_time;<br>
1458&nbsp;&nbsp;time_t creation_time;<br>
1459&nbsp;&nbsp;char * dest;<br>
1460&nbsp;&nbsp;char * format;<br>
1461&nbsp;&nbsp;int id;<br>
1462&nbsp;&nbsp;int priority;<br>
1463&nbsp;&nbsp;time_t processing_time;<br>
1464&nbsp;&nbsp;int size;<br>
1465&nbsp;&nbsp;ipp_jstate_t state;<br>
1466&nbsp;&nbsp;char * title;<br>
1467&nbsp;&nbsp;char * user;<br>
1468};</tt></p>
ef416fc2 1469<h4>Members</h4>
bc44d920 1470<div class='table'><table align='center' border='1' width='80%' summary='Members'>
ef416fc2 1471<thead><tr><th>Name</th><th>Description</th></tr></thead>
1472<tbody>
bc44d920 1473<tr><td><tt>completed_time</tt> </td><td>Time the job was completed
1474</td></tr>
1475<tr><td><tt>creation_time</tt> </td><td>Time the job was created
1476</td></tr>
1477<tr><td><tt>dest</tt> </td><td>Printer or class name
1478</td></tr>
1479<tr><td><tt>format</tt> </td><td>Document format
1480</td></tr>
1481<tr><td><tt>id</tt> </td><td>The job ID
1482</td></tr>
1483<tr><td><tt>priority</tt> </td><td>Priority (1-100)
1484</td></tr>
1485<tr><td><tt>processing_time</tt> </td><td>Time the job was processed
1486</td></tr>
1487<tr><td><tt>size</tt> </td><td>Size in kilobytes
1488</td></tr>
1489<tr><td><tt>state</tt> </td><td>Job state
1490</td></tr>
1491<tr><td><tt>title</tt> </td><td>Title/job name
1492</td></tr>
1493<tr><td><tt>user</tt> </td><td>User the submitted the job
1494</td></tr>
ef416fc2 1495</tbody></table></div>
1496<!-- NEW PAGE -->
1497<h3 class='title'><a name='cups_option_s'>cups_option_s</a></h3>
1498<h4>Description</h4>
bc44d920 1499<p>Printer Options
ef416fc2 1500<h4>Definition</h4>
bc44d920 1501<p><tt>
1502struct cups_option_s<br>
1503{<br>
1504&nbsp;&nbsp;char * name;<br>
1505&nbsp;&nbsp;char * value;<br>
1506};</tt></p>
ef416fc2 1507<h4>Members</h4>
bc44d920 1508<div class='table'><table align='center' border='1' width='80%' summary='Members'>
ef416fc2 1509<thead><tr><th>Name</th><th>Description</th></tr></thead>
1510<tbody>
bc44d920 1511<tr><td><tt>name</tt> </td><td>Name of option
1512</td></tr>
1513<tr><td><tt>value</tt> </td><td>Value of option
1514</td></tr>
ef416fc2 1515</tbody></table></div>
1516<!-- NEW PAGE -->
1517<h2 class='title'><a name='TYPES'>Types</a></h2>
1518<ul>
ef416fc2 1519 <li><a href='#cups_dest_t'><tt>cups_dest_t</tt></a> </li>
1520 <li><a href='#cups_job_t'><tt>cups_job_t</tt></a> </li>
1521 <li><a href='#cups_option_t'><tt>cups_option_t</tt></a> </li>
ecdc0628 1522 <li><a href='#cups_password_cb_t'><tt>cups_password_cb_t</tt></a> </li>
ef416fc2 1523 <li><a href='#cups_ptype_t'><tt>cups_ptype_t</tt></a> </li>
1524</ul>
1525<!-- NEW PAGE -->
ef416fc2 1526<h3 class='title'><a name='cups_dest_t'>cups_dest_t</a></h3>
1527<h4>Description</h4>
bc44d920 1528<p>Destination
ef416fc2 1529<h4>Definition</h4>
bc44d920 1530<p><tt>
ef416fc2 1531typedef struct <a href='#cups_dest_s'>cups_dest_s</a> cups_dest_t;
bc44d920 1532</tt></p>
ef416fc2 1533<!-- NEW PAGE -->
1534<h3 class='title'><a name='cups_job_t'>cups_job_t</a></h3>
1535<h4>Description</h4>
bc44d920 1536<p>Job
ef416fc2 1537<h4>Definition</h4>
bc44d920 1538<p><tt>
ef416fc2 1539typedef struct <a href='#cups_job_s'>cups_job_s</a> cups_job_t;
bc44d920 1540</tt></p>
ef416fc2 1541<!-- NEW PAGE -->
1542<h3 class='title'><a name='cups_option_t'>cups_option_t</a></h3>
1543<h4>Description</h4>
bc44d920 1544<p>Printer Options
ef416fc2 1545<h4>Definition</h4>
bc44d920 1546<p><tt>
ef416fc2 1547typedef struct <a href='#cups_option_s'>cups_option_s</a> cups_option_t;
bc44d920 1548</tt></p>
ef416fc2 1549<!-- NEW PAGE -->
ecdc0628 1550<h3 class='title'><a name='cups_password_cb_t'>cups_password_cb_t</a></h3>
1551<h4>Description</h4>
bc44d920 1552<p>Password callback
ecdc0628 1553<h4>Definition</h4>
bc44d920 1554<p><tt>
ecdc0628 1555typedef const char * (*cups_password_cb_t)(const char *);
bc44d920 1556</tt></p>
ecdc0628 1557<!-- NEW PAGE -->
ef416fc2 1558<h3 class='title'><a name='cups_ptype_t'>cups_ptype_t</a></h3>
1559<h4>Description</h4>
bc44d920 1560<p>Printer Type/Capability Bits
ef416fc2 1561<h4>Definition</h4>
bc44d920 1562<p><tt>
ef416fc2 1563typedef unsigned cups_ptype_t;
bc44d920 1564</tt></p>
ef416fc2 1565</body>
1566</html>