]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/api-cgi.html
More man page modernization.
[thirdparty/cups.git] / doc / help / api-cgi.html
CommitLineData
f11a948a
MS
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- SECTION: Programming -->
4<head>
0268488e
MS
5 <title>CGI API </title>
6 <meta name="keywords" content="Programming">
7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
8 <meta name="creator" content="Mini-XML v2.7">
f11a948a
MS
9<style type="text/css"><!--
10BODY {
11 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
12}
13
14H1, H2, H3, H4, H5, H6, P, TD, TH {
15 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
16}
17
18KBD {
19 font-family: monaco, courier, monospace;
20 font-weight: bold;
21}
22
23PRE {
24 font-family: monaco, courier, monospace;
25}
26
27PRE.command {
10d09e33 28 border: dotted thin #7f7f7f;
f11a948a 29 margin-left: 36pt;
10d09e33 30 padding: 10px;
f11a948a
MS
31}
32
33P.compact {
34 margin: 0;
35}
36
37P.example {
38 font-style: italic;
39 margin-left: 36pt;
40}
ca6b43fc 41
f11a948a
MS
42PRE.example {
43 background: #eeeeee;
44 border: dotted thin #999999;
45 margin-left: 36pt;
178cb736 46 padding: 10pt;
f11a948a
MS
47}
48
49PRE.command EM, PRE.example EM {
50 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
51}
52
53P.command {
54 font-family: monaco, courier, monospace;
55 margin-left: 36pt;
56}
57
58P.formula {
59 font-style: italic;
60 margin-left: 36pt;
61}
62
63BLOCKQUOTE {
178cb736 64 background: #eeeeee;
f11a948a
MS
65 border: solid thin #999999;
66 padding: 10pt;
67}
68
69A IMG {
70 border: none;
71}
72
73A:link:hover IMG {
74 background: #f0f0f0;
75 border-radius: 10px;
76 -moz-border-radius: 10px;
77}
78
79A:link, A:visited {
ca6b43fc 80 font-weight: inherit;
f11a948a
MS
81 text-decoration: none;
82}
83
84A:link:hover, A:visited:hover, A:active {
85 text-decoration: underline;
86}
87
88SUB, SUP {
89 font-size: 50%;
90}
91
92TR.data, TD.data, TR.data TD {
93 margin-top: 10pt;
94 padding: 5pt;
95 border-bottom: solid 1pt #999999;
96}
97
98TR.data TH {
99 border-bottom: solid 1pt #999999;
100 padding-top: 10pt;
101 padding-left: 5pt;
102 text-align: left;
103}
104
105DIV.table TABLE {
106 border: solid thin #999999;
107 border-collapse: collapse;
108 border-spacing: 0;
109 margin-left: auto;
110 margin-right: auto;
111}
112
113DIV.table CAPTION {
114 caption-side: top;
115 font-size: 120%;
116 font-style: italic;
117 font-weight: bold;
118 margin-left: auto;
119 margin-right: auto;
120}
121
122DIV.table TABLE TD {
123 border: solid thin #cccccc;
124 padding-top: 5pt;
125}
126
127DIV.table TABLE TH {
128 background: #cccccc;
129 border: none;
130 border-bottom: solid thin #999999;
131}
132
133DIV.figure TABLE {
134 margin-left: auto;
135 margin-right: auto;
136}
137
138DIV.figure CAPTION {
139 caption-side: bottom;
140 font-size: 120%;
141 font-style: italic;
142 font-weight: bold;
143 margin-left: auto;
144 margin-right: auto;
145}
146
147TH.label {
148 text-align: right;
149 vertical-align: top;
150}
151
152TH.sublabel {
153 text-align: right;
154 font-weight: normal;
155}
156
157HR {
158 border: solid thin;
159}
160
161SPAN.info {
162 background: black;
163 border: thin solid black;
164 color: white;
165 font-size: 80%;
166 font-style: italic;
167 font-weight: bold;
168 white-space: nowrap;
169}
170
171H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
172 float: right;
173 font-size: 100%;
174}
175
178cb736
MS
176H1.title {
177}
178
f11a948a
MS
179H2.title, H3.title {
180 border-bottom: solid 2pt #000000;
181}
182
183DIV.indent, TABLE.indent {
184 margin-top: 2em;
185 margin-left: auto;
186 margin-right: auto;
187 width: 90%;
188}
189
190TABLE.indent {
191 border-collapse: collapse;
192}
193
194TABLE.indent TD, TABLE.indent TH {
195 padding: 0;
196}
197
198TABLE.list {
199 border-collapse: collapse;
200 margin-left: auto;
201 margin-right: auto;
202 width: 90%;
203}
204
205TABLE.list TH {
206 background: white;
207 border-bottom: solid thin #cccccc;
208 color: #444444;
209 padding-top: 10pt;
210 padding-left: 5pt;
211 text-align: left;
212 vertical-align: bottom;
213 white-space: nowrap;
214}
215
216TABLE.list TH A {
217 color: #4444cc;
218}
219
220TABLE.list TD {
221 border-bottom: solid thin #eeeeee;
222 padding-top: 5pt;
223 padding-left: 5pt;
224}
225
226TABLE.list TR:nth-child(even) {
227 background: #f8f8f8;
228}
229
230TABLE.list TR:nth-child(odd) {
231 background: #f4f4f4;
232}
233
234DT {
235 margin-left: 36pt;
236 margin-top: 12pt;
237}
238
239DD {
240 margin-left: 54pt;
241}
242
243DL.category DT {
244 font-weight: bold;
245}
246
247P.summary {
248 margin-left: 36pt;
249 font-family: monaco, courier, monospace;
250}
251
252DIV.summary TABLE {
253 border: solid thin #999999;
254 border-collapse: collapse;
255 border-spacing: 0;
256 margin: 10px;
257}
258
259DIV.summary TABLE TD, DIV.summary TABLE TH {
260 border: solid thin #999999;
261 padding: 5px;
262 text-align: left;
263 vertical-align: top;
264}
265
266DIV.summary TABLE THEAD TH {
267 background: #eeeeee;
268}
269
270/* API documentation styles... */
271div.body h1 {
272 margin: 0;
273}
274div.body h2 {
275 margin-top: 1.5em;
276}
277div.body h3, div.body h4, div.body h5 {
278 margin-bottom: 0.5em;
279 margin-top: 1.5em;
280}
281.class, .enumeration, .function, .struct, .typedef, .union {
282 border-bottom: solid thin #999999;
283 margin-bottom: 0;
284 margin-top: 2em;
285}
286.description {
287 margin-top: 0.5em;
288}
289code, p.code, pre, ul.code li {
290 font-family: monaco, courier, monospace;
291 font-size: 90%;
292}
293ul.code, ul.contents, ul.subcontents {
294 list-style-type: none;
295 margin: 0;
296 padding-left: 0;
297}
298ul.code li {
299 margin: 0;
300}
301ul.contents > li {
302 margin-top: 1em;
303}
304ul.contents li ul.code, ul.contents li ul.subcontents {
305 padding-left: 2em;
306}
307div.body dl {
308 margin-left: 0;
309 margin-top: 0;
310}
311div.body dt {
312 font-style: italic;
313 margin-left: 0;
314 margin-top: 0;
315}
316div.body dd {
317 margin-bottom: 0.5em;
318}
319
320/* This is just for the HTML files generated with the framedhelp target */
321div.contents {
322 background: #e8e8e8;
323 border: solid thin black;
324 padding: 10px;
325}
326div.contents h1 {
327 font-size: 110%;
328}
329div.contents h2 {
330 font-size: 100%;
331}
332div.contents ul.contents {
333 font-size: 80%;
334}
335div.contents ul.subcontents li {
336 margin-left: 1em;
337 text-indent: -1em;
338}
339--></style>
340</head>
341<body>
342<div class='body'>
178cb736 343<!--
9c0e8e5d 344 "$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $"
178cb736
MS
345
346 CGI API header for CUPS.
347
348 Copyright 2009 by Apple Inc.
349
350 These coded instructions, statements, and computer programs are the
351 property of Apple Inc. and are protected by Federal copyright
352 law. Distribution and use rights are outlined in the file "LICENSE.txt"
353 which should have been included with this file. If this file is
354 file is missing or damaged, see the license at "http://www.cups.org/".
355-->
356
357<h1 class='title'>CGI API</h1>
358
359<div class='summary'><table summary='General Information'>
360<thead>
361<tr>
362 <th>Header</th>
363 <th>cups/cgi.h</th>
364</tr>
365</thead>
366<tbody>
367<tr>
368 <th>Library</th>
369 <td>-lcupscgi</td>
370</tr>
371<tr>
372 <th>See Also</th>
373 <td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td>
374</tr>
375</tbody>
376</table></div>
f11a948a
MS
377<h2 class="title">Contents</h2>
378<ul class="contents">
178cb736 379<li><a href="#OVERVIEW">Overview</a></li>
f11a948a 380<li><a href="#FUNCTIONS">Functions</a><ul class="code">
0268488e
MS
381 <li><a href="#cgiCheckVariables" title="Check for the presence of &quot;required&quot; variables.">cgiCheckVariables</a></li>
382 <li><a href="#cgiClearVariables" title="Clear all form variables.">cgiClearVariables</a></li>
383 <li><a href="#cgiCompileSearch" title="Compile a search string.">cgiCompileSearch</a></li>
384 <li><a href="#cgiCopyTemplateFile" title="Copy a template file and replace all the
f11a948a 385'{variable}' strings with the variable value.">cgiCopyTemplateFile</a></li>
0268488e
MS
386 <li><a href="#cgiCopyTemplateLang" title="Copy a template file using a language...">cgiCopyTemplateLang</a></li>
387 <li><a href="#cgiDoSearch" title="Do a search of some text.">cgiDoSearch</a></li>
388 <li><a href="#cgiEndHTML" title="End a HTML page.">cgiEndHTML</a></li>
389 <li><a href="#cgiEndMultipart" title="End the delivery of a multipart web page.">cgiEndMultipart</a></li>
390 <li><a href="#cgiFormEncode" title="Encode a string as a form variable.">cgiFormEncode</a></li>
391 <li><a href="#cgiFreeSearch" title="Free a compiled search context.">cgiFreeSearch</a></li>
392 <li><a href="#cgiGetArray" title="Get an element from a form array.">cgiGetArray</a></li>
393 <li><a href="#cgiGetAttributes" title="Get the list of attributes that are needed
f11a948a 394by the template file.">cgiGetAttributes</a></li>
0268488e
MS
395 <li><a href="#cgiGetCookie" title="Get a cookie value.">cgiGetCookie</a></li>
396 <li><a href="#cgiGetFile" title="Get the file (if any) that was submitted in the form.">cgiGetFile</a></li>
397 <li><a href="#cgiGetIPPObjects" title="Get the objects in an IPP response.">cgiGetIPPObjects</a></li>
398 <li><a href="#cgiGetSize" title="Get the size of a form array value.">cgiGetSize</a></li>
399 <li><a href="#cgiGetTemplateDir" title="Get the templates directory...">cgiGetTemplateDir</a></li>
400 <li><a href="#cgiGetVariable" title="Get a CGI variable from the database.">cgiGetVariable</a></li>
401 <li><a href="#cgiInitialize" title="Initialize the CGI variable &quot;database&quot;.">cgiInitialize</a></li>
402 <li><a href="#cgiIsPOST" title="Determine whether this page was POSTed.">cgiIsPOST</a></li>
403 <li><a href="#cgiMoveJobs" title="Move one or more jobs.">cgiMoveJobs</a></li>
404 <li><a href="#cgiPrintCommand" title="Print a CUPS command job.">cgiPrintCommand</a></li>
405 <li><a href="#cgiPrintTestPage" title="Print a test page.">cgiPrintTestPage</a></li>
406 <li><a href="#cgiRewriteURL" title="Rewrite a printer URI into a web browser URL...">cgiRewriteURL</a></li>
407 <li><a href="#cgiSetArray" title="Set array element N to the specified string.">cgiSetArray</a></li>
408 <li><a href="#cgiSetCookie" title="Set a cookie value.">cgiSetCookie</a></li>
409 <li><a href="#cgiSetIPPObjectVars" title="Set CGI variables from an IPP object.">cgiSetIPPObjectVars</a></li>
410 <li><a href="#cgiSetIPPVars" title="Set CGI variables from an IPP response.">cgiSetIPPVars</a></li>
411 <li><a href="#cgiSetServerVersion" title="Set the server name and CUPS version...">cgiSetServerVersion</a></li>
412 <li><a href="#cgiSetSize" title="Set the array size.">cgiSetSize</a></li>
413 <li><a href="#cgiSetVariable" title="Set a CGI variable in the database.">cgiSetVariable</a></li>
414 <li><a href="#cgiShowIPPError" title="Show the last IPP error message.">cgiShowIPPError</a></li>
415 <li><a href="#cgiShowJobs" title="Show print jobs.">cgiShowJobs</a></li>
416 <li><a href="#cgiStartHTML" title="Start a HTML page.">cgiStartHTML</a></li>
417 <li><a href="#cgiStartMultipart" title="Start a multipart delivery of a web page.">cgiStartMultipart</a></li>
418 <li><a href="#cgiSupportsMultipart" title="Does the browser support multi-part documents?">cgiSupportsMultipart</a></li>
419 <li><a href="#cgiText" title="Return localized text.">cgiText</a></li>
420 <li><a href="#helpDeleteIndex" title="Delete an index, freeing all memory used.">helpDeleteIndex</a></li>
421 <li><a href="#helpFindNode" title="Find a node in an index.">helpFindNode</a></li>
422 <li><a href="#helpLoadIndex" title="Load a help index from disk.">helpLoadIndex</a></li>
423 <li><a href="#helpSaveIndex" title="Save a help index to disk.">helpSaveIndex</a></li>
424 <li><a href="#helpSearchIndex" title="Search an index.">helpSearchIndex</a></li>
f11a948a
MS
425</ul></li>
426<li><a href="#TYPES">Data Types</a><ul class="code">
427 <li><a href="#cgi_file_t" title="Uploaded file data">cgi_file_t</a></li>
428 <li><a href="#help_index_t" title="Help index structure">help_index_t</a></li>
429 <li><a href="#help_node_t" title="Help node structure...">help_node_t</a></li>
430 <li><a href="#help_word_t" title="Help word structure...">help_word_t</a></li>
431</ul></li>
432<li><a href="#STRUCTURES">Structures</a><ul class="code">
433 <li><a href="#cgi_file_s" title="Uploaded file data">cgi_file_s</a></li>
434 <li><a href="#help_index_s" title="Help index structure">help_index_s</a></li>
435 <li><a href="#help_node_s" title="Help node structure...">help_node_s</a></li>
436 <li><a href="#help_word_s" title="Help word structure...">help_word_s</a></li>
437</ul></li>
0268488e 438</ul>
178cb736 439<!--
9c0e8e5d 440 "$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
178cb736
MS
441
442 CGI API introduction for CUPS.
443
444 Copyright 2009 by Apple Inc.
445
446 These coded instructions, statements, and computer programs are the
447 property of Apple Inc. and are protected by Federal copyright
448 law. Distribution and use rights are outlined in the file "LICENSE.txt"
449 which should have been included with this file. If this file is
450 file is missing or damaged, see the license at "http://www.cups.org/".
451-->
452
453<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
454
455<p>The CGI API provides Common Gateway Interface functions for CUPS.</p>
f11a948a
MS
456<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
457<h3 class="function"><a name="cgiCheckVariables">cgiCheckVariables</a></h3>
458<p class="description">Check for the presence of &quot;required&quot; variables.</p>
459<p class="code">
460int cgiCheckVariables (<br>
461&nbsp;&nbsp;&nbsp;&nbsp;const char *names<br>
462);</p>
463<h4 class="parameters">Parameters</h4>
464<dl>
465<dt>names</dt>
466<dd class="description">Variables to look for</dd>
467</dl>
468<h4 class="returnvalue">Return Value</h4>
469<p class="description">1 if all variables present, 0 otherwise</p>
470<h4 class="discussion">Discussion</h4>
471<p class="discussion">Names may be separated by spaces and/or commas.</p>
aaf19ab0
MS
472<h3 class="function"><a name="cgiClearVariables">cgiClearVariables</a></h3>
473<p class="description">Clear all form variables.</p>
474<p class="code">
475void cgiClearVariables (void);</p>
f11a948a
MS
476<h3 class="function"><a name="cgiCompileSearch">cgiCompileSearch</a></h3>
477<p class="description">Compile a search string.</p>
478<p class="code">
479void *cgiCompileSearch (<br>
480&nbsp;&nbsp;&nbsp;&nbsp;const char *query<br>
481);</p>
482<h4 class="parameters">Parameters</h4>
483<dl>
484<dt>query</dt>
485<dd class="description">Query string</dd>
486</dl>
487<h4 class="returnvalue">Return Value</h4>
488<p class="description">Search context</p>
489<h3 class="function"><a name="cgiCopyTemplateFile">cgiCopyTemplateFile</a></h3>
490<p class="description">Copy a template file and replace all the
491'{variable}' strings with the variable value.</p>
492<p class="code">
493void cgiCopyTemplateFile (<br>
494&nbsp;&nbsp;&nbsp;&nbsp;FILE *out,<br>
495&nbsp;&nbsp;&nbsp;&nbsp;const char *tmpl<br>
496);</p>
497<h4 class="parameters">Parameters</h4>
498<dl>
499<dt>out</dt>
500<dd class="description">Output file</dd>
501<dt>tmpl</dt>
502<dd class="description">Template file to read</dd>
503</dl>
504<h3 class="function"><a name="cgiCopyTemplateLang">cgiCopyTemplateLang</a></h3>
505<p class="description">Copy a template file using a language...</p>
506<p class="code">
507void cgiCopyTemplateLang (<br>
508&nbsp;&nbsp;&nbsp;&nbsp;const char *tmpl<br>
509);</p>
510<h4 class="parameters">Parameters</h4>
511<dl>
512<dt>tmpl</dt>
513<dd class="description">Base filename</dd>
514</dl>
515<h3 class="function"><a name="cgiDoSearch">cgiDoSearch</a></h3>
516<p class="description">Do a search of some text.</p>
517<p class="code">
518int cgiDoSearch (<br>
519&nbsp;&nbsp;&nbsp;&nbsp;void *search,<br>
520&nbsp;&nbsp;&nbsp;&nbsp;const char *text<br>
521);</p>
522<h4 class="parameters">Parameters</h4>
523<dl>
524<dt>search</dt>
525<dd class="description">Search context</dd>
526<dt>text</dt>
527<dd class="description">Text to search</dd>
528</dl>
529<h4 class="returnvalue">Return Value</h4>
530<p class="description">Number of matches</p>
531<h3 class="function"><a name="cgiEndHTML">cgiEndHTML</a></h3>
532<p class="description">End a HTML page.</p>
533<p class="code">
534void cgiEndHTML (void);</p>
535<h3 class="function"><a name="cgiEndMultipart">cgiEndMultipart</a></h3>
536<p class="description">End the delivery of a multipart web page.</p>
537<p class="code">
538void cgiEndMultipart (void);</p>
539<h3 class="function"><a name="cgiFormEncode">cgiFormEncode</a></h3>
540<p class="description">Encode a string as a form variable.</p>
541<p class="code">
542char *cgiFormEncode (<br>
543&nbsp;&nbsp;&nbsp;&nbsp;char *dst,<br>
544&nbsp;&nbsp;&nbsp;&nbsp;const char *src,<br>
545&nbsp;&nbsp;&nbsp;&nbsp;size_t dstsize<br>
546);</p>
547<h4 class="parameters">Parameters</h4>
548<dl>
549<dt>dst</dt>
550<dd class="description">Destination string</dd>
551<dt>src</dt>
552<dd class="description">Source string</dd>
553<dt>dstsize</dt>
554<dd class="description">Size of destination string</dd>
555</dl>
556<h4 class="returnvalue">Return Value</h4>
557<p class="description">Destination string</p>
558<h3 class="function"><a name="cgiFreeSearch">cgiFreeSearch</a></h3>
559<p class="description">Free a compiled search context.</p>
560<p class="code">
561void cgiFreeSearch (<br>
562&nbsp;&nbsp;&nbsp;&nbsp;void *search<br>
563);</p>
564<h4 class="parameters">Parameters</h4>
565<dl>
566<dt>search</dt>
567<dd class="description">Search context</dd>
568</dl>
569<h3 class="function"><a name="cgiGetArray">cgiGetArray</a></h3>
aaf19ab0 570<p class="description">Get an element from a form array.</p>
f11a948a
MS
571<p class="code">
572const char *cgiGetArray (<br>
573&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
574&nbsp;&nbsp;&nbsp;&nbsp;int element<br>
575);</p>
576<h4 class="parameters">Parameters</h4>
577<dl>
578<dt>name</dt>
579<dd class="description">Name of array variable</dd>
580<dt>element</dt>
581<dd class="description">Element number (0 to N)</dd>
582</dl>
583<h4 class="returnvalue">Return Value</h4>
584<p class="description">Element value or NULL</p>
585<h3 class="function"><a name="cgiGetAttributes">cgiGetAttributes</a></h3>
586<p class="description">Get the list of attributes that are needed
587by the template file.</p>
588<p class="code">
589void cgiGetAttributes (<br>
590&nbsp;&nbsp;&nbsp;&nbsp;ipp_t *request,<br>
591&nbsp;&nbsp;&nbsp;&nbsp;const char *tmpl<br>
592);</p>
593<h4 class="parameters">Parameters</h4>
594<dl>
595<dt>request</dt>
596<dd class="description">IPP request</dd>
597<dt>tmpl</dt>
598<dd class="description">Base filename</dd>
599</dl>
aaf19ab0
MS
600<h3 class="function"><a name="cgiGetCookie">cgiGetCookie</a></h3>
601<p class="description">Get a cookie value.</p>
602<p class="code">
603const char *cgiGetCookie (<br>
604&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
605);</p>
606<h4 class="parameters">Parameters</h4>
607<dl>
608<dt>name</dt>
609<dd class="description">Name of cookie</dd>
610</dl>
611<h4 class="returnvalue">Return Value</h4>
612<p class="description">Value or NULL</p>
f11a948a
MS
613<h3 class="function"><a name="cgiGetFile">cgiGetFile</a></h3>
614<p class="description">Get the file (if any) that was submitted in the form.</p>
615<p class="code">
616const <a href="#cgi_file_t">cgi_file_t</a> *cgiGetFile (void);</p>
617<h4 class="returnvalue">Return Value</h4>
618<p class="description">Attached file or NULL</p>
619<h3 class="function"><a name="cgiGetIPPObjects">cgiGetIPPObjects</a></h3>
620<p class="description">Get the objects in an IPP response.</p>
621<p class="code">
622cups_array_t *cgiGetIPPObjects (<br>
623&nbsp;&nbsp;&nbsp;&nbsp;ipp_t *response,<br>
624&nbsp;&nbsp;&nbsp;&nbsp;void *search<br>
625);</p>
626<h4 class="parameters">Parameters</h4>
627<dl>
628<dt>response</dt>
629<dd class="description">IPP response</dd>
630<dt>search</dt>
631<dd class="description">Search filter</dd>
632</dl>
633<h4 class="returnvalue">Return Value</h4>
634<p class="description">Array of objects</p>
635<h3 class="function"><a name="cgiGetSize">cgiGetSize</a></h3>
636<p class="description">Get the size of a form array value.</p>
637<p class="code">
638int cgiGetSize (<br>
639&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
640);</p>
641<h4 class="parameters">Parameters</h4>
642<dl>
643<dt>name</dt>
644<dd class="description">Name of variable</dd>
645</dl>
646<h4 class="returnvalue">Return Value</h4>
647<p class="description">Number of elements</p>
648<h3 class="function"><a name="cgiGetTemplateDir">cgiGetTemplateDir</a></h3>
649<p class="description">Get the templates directory...</p>
650<p class="code">
651char *cgiGetTemplateDir (void);</p>
652<h4 class="returnvalue">Return Value</h4>
653<p class="description">Template directory</p>
654<h3 class="function"><a name="cgiGetVariable">cgiGetVariable</a></h3>
aaf19ab0 655<p class="description">Get a CGI variable from the database.</p>
f11a948a
MS
656<p class="code">
657const char *cgiGetVariable (<br>
658&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
659);</p>
660<h4 class="parameters">Parameters</h4>
661<dl>
662<dt>name</dt>
663<dd class="description">Name of variable</dd>
664</dl>
665<h4 class="returnvalue">Return Value</h4>
666<p class="description">Value of variable</p>
667<h4 class="discussion">Discussion</h4>
668<p class="discussion">Returns NULL if the variable doesn't exist. If the variable is an
aaf19ab0 669array of values, returns the last element.</p>
f11a948a 670<h3 class="function"><a name="cgiInitialize">cgiInitialize</a></h3>
aaf19ab0 671<p class="description">Initialize the CGI variable &quot;database&quot;.</p>
f11a948a
MS
672<p class="code">
673int cgiInitialize (void);</p>
674<h4 class="returnvalue">Return Value</h4>
675<p class="description">Non-zero if there was form data</p>
676<h3 class="function"><a name="cgiIsPOST">cgiIsPOST</a></h3>
677<p class="description">Determine whether this page was POSTed.</p>
678<p class="code">
679int cgiIsPOST (void);</p>
680<h4 class="returnvalue">Return Value</h4>
681<p class="description">1 if POST, 0 if GET</p>
682<h3 class="function"><a name="cgiMoveJobs">cgiMoveJobs</a></h3>
683<p class="description">Move one or more jobs.</p>
684<p class="code">
685void cgiMoveJobs (<br>
686&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
687&nbsp;&nbsp;&nbsp;&nbsp;const char *dest,<br>
688&nbsp;&nbsp;&nbsp;&nbsp;int job_id<br>
689);</p>
690<h4 class="parameters">Parameters</h4>
691<dl>
692<dt>http</dt>
693<dd class="description">Connection to server</dd>
694<dt>dest</dt>
695<dd class="description">Destination or NULL</dd>
696<dt>job_id</dt>
697<dd class="description">Job ID or 0 for all</dd>
698</dl>
699<h4 class="discussion">Discussion</h4>
700<p class="discussion">At least one of dest or job_id must be non-zero/NULL.</p>
701<h3 class="function"><a name="cgiPrintCommand">cgiPrintCommand</a></h3>
702<p class="description">Print a CUPS command job.</p>
703<p class="code">
704void cgiPrintCommand (<br>
705&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
706&nbsp;&nbsp;&nbsp;&nbsp;const char *dest,<br>
707&nbsp;&nbsp;&nbsp;&nbsp;const char *command,<br>
708&nbsp;&nbsp;&nbsp;&nbsp;const char *title<br>
709);</p>
710<h4 class="parameters">Parameters</h4>
711<dl>
712<dt>http</dt>
713<dd class="description">Connection to server</dd>
714<dt>dest</dt>
715<dd class="description">Destination printer</dd>
716<dt>command</dt>
717<dd class="description">Command to send</dd>
718<dt>title</dt>
719<dd class="description">Page/job title</dd>
720</dl>
721<h3 class="function"><a name="cgiPrintTestPage">cgiPrintTestPage</a></h3>
722<p class="description">Print a test page.</p>
723<p class="code">
724void cgiPrintTestPage (<br>
725&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
726&nbsp;&nbsp;&nbsp;&nbsp;const char *dest<br>
727);</p>
728<h4 class="parameters">Parameters</h4>
729<dl>
730<dt>http</dt>
731<dd class="description">Connection to server</dd>
732<dt>dest</dt>
733<dd class="description">Destination printer/class</dd>
734</dl>
735<h3 class="function"><a name="cgiRewriteURL">cgiRewriteURL</a></h3>
736<p class="description">Rewrite a printer URI into a web browser URL...</p>
737<p class="code">
738char *cgiRewriteURL (<br>
739&nbsp;&nbsp;&nbsp;&nbsp;const char *uri,<br>
740&nbsp;&nbsp;&nbsp;&nbsp;char *url,<br>
741&nbsp;&nbsp;&nbsp;&nbsp;int urlsize,<br>
742&nbsp;&nbsp;&nbsp;&nbsp;const char *newresource<br>
743);</p>
744<h4 class="parameters">Parameters</h4>
745<dl>
746<dt>uri</dt>
747<dd class="description">Current URI</dd>
748<dt>url</dt>
749<dd class="description">New URL</dd>
750<dt>urlsize</dt>
751<dd class="description">Size of URL buffer</dd>
752<dt>newresource</dt>
753<dd class="description">Replacement resource</dd>
754</dl>
755<h4 class="returnvalue">Return Value</h4>
756<p class="description">New URL</p>
757<h3 class="function"><a name="cgiSetArray">cgiSetArray</a></h3>
758<p class="description">Set array element N to the specified string.</p>
759<p class="code">
760void cgiSetArray (<br>
761&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
762&nbsp;&nbsp;&nbsp;&nbsp;int element,<br>
763&nbsp;&nbsp;&nbsp;&nbsp;const char *value<br>
764);</p>
765<h4 class="parameters">Parameters</h4>
766<dl>
767<dt>name</dt>
768<dd class="description">Name of variable</dd>
769<dt>element</dt>
770<dd class="description">Element number (0 to N)</dd>
771<dt>value</dt>
772<dd class="description">Value of variable</dd>
773</dl>
774<h4 class="discussion">Discussion</h4>
775<p class="discussion">If the variable array is smaller than (element + 1), the intervening
776elements are set to NULL.</p>
aaf19ab0
MS
777<h3 class="function"><a name="cgiSetCookie">cgiSetCookie</a></h3>
778<p class="description">Set a cookie value.</p>
779<p class="code">
780void cgiSetCookie (<br>
781&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
782&nbsp;&nbsp;&nbsp;&nbsp;const char *value,<br>
783&nbsp;&nbsp;&nbsp;&nbsp;const char *path,<br>
784&nbsp;&nbsp;&nbsp;&nbsp;const char *domain,<br>
785&nbsp;&nbsp;&nbsp;&nbsp;time_t expires,<br>
786&nbsp;&nbsp;&nbsp;&nbsp;int secure<br>
787);</p>
788<h4 class="parameters">Parameters</h4>
789<dl>
790<dt>name</dt>
791<dd class="description">Name</dd>
792<dt>value</dt>
793<dd class="description">Value</dd>
794<dt>path</dt>
795<dd class="description">Path (typically &quot;/&quot;)</dd>
796<dt>domain</dt>
797<dd class="description">Domain name</dd>
798<dt>expires</dt>
799<dd class="description">Expiration date (0 for session)</dd>
800<dt>secure</dt>
801<dd class="description">Require SSL</dd>
802</dl>
f11a948a
MS
803<h3 class="function"><a name="cgiSetIPPObjectVars">cgiSetIPPObjectVars</a></h3>
804<p class="description">Set CGI variables from an IPP object.</p>
805<p class="code">
806ipp_attribute_t *cgiSetIPPObjectVars (<br>
807&nbsp;&nbsp;&nbsp;&nbsp;ipp_attribute_t *obj,<br>
808&nbsp;&nbsp;&nbsp;&nbsp;const char *prefix,<br>
809&nbsp;&nbsp;&nbsp;&nbsp;int element<br>
810);</p>
811<h4 class="parameters">Parameters</h4>
812<dl>
813<dt>obj</dt>
814<dd class="description">Response data to be copied...</dd>
815<dt>prefix</dt>
816<dd class="description">Prefix for name or NULL</dd>
817<dt>element</dt>
818<dd class="description">Parent element number</dd>
819</dl>
820<h4 class="returnvalue">Return Value</h4>
821<p class="description">Next object</p>
822<h3 class="function"><a name="cgiSetIPPVars">cgiSetIPPVars</a></h3>
823<p class="description">Set CGI variables from an IPP response.</p>
824<p class="code">
825int cgiSetIPPVars (<br>
826&nbsp;&nbsp;&nbsp;&nbsp;ipp_t *response,<br>
827&nbsp;&nbsp;&nbsp;&nbsp;const char *filter_name,<br>
828&nbsp;&nbsp;&nbsp;&nbsp;const char *filter_value,<br>
829&nbsp;&nbsp;&nbsp;&nbsp;const char *prefix,<br>
830&nbsp;&nbsp;&nbsp;&nbsp;int parent_el<br>
831);</p>
832<h4 class="parameters">Parameters</h4>
833<dl>
834<dt>response</dt>
835<dd class="description">Response data to be copied...</dd>
836<dt>filter_name</dt>
837<dd class="description">Filter name</dd>
838<dt>filter_value</dt>
839<dd class="description">Filter value</dd>
840<dt>prefix</dt>
841<dd class="description">Prefix for name or NULL</dd>
842<dt>parent_el</dt>
843<dd class="description">Parent element number</dd>
844</dl>
845<h4 class="returnvalue">Return Value</h4>
846<p class="description">Maximum number of elements</p>
847<h3 class="function"><a name="cgiSetServerVersion">cgiSetServerVersion</a></h3>
848<p class="description">Set the server name and CUPS version...</p>
849<p class="code">
850void cgiSetServerVersion (void);</p>
851<h3 class="function"><a name="cgiSetSize">cgiSetSize</a></h3>
852<p class="description">Set the array size.</p>
853<p class="code">
854void cgiSetSize (<br>
855&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
856&nbsp;&nbsp;&nbsp;&nbsp;int size<br>
857);</p>
858<h4 class="parameters">Parameters</h4>
859<dl>
860<dt>name</dt>
861<dd class="description">Name of variable</dd>
862<dt>size</dt>
863<dd class="description">Number of elements (0 to N)</dd>
864</dl>
865<h3 class="function"><a name="cgiSetVariable">cgiSetVariable</a></h3>
aaf19ab0 866<p class="description">Set a CGI variable in the database.</p>
f11a948a
MS
867<p class="code">
868void cgiSetVariable (<br>
869&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
870&nbsp;&nbsp;&nbsp;&nbsp;const char *value<br>
871);</p>
872<h4 class="parameters">Parameters</h4>
873<dl>
874<dt>name</dt>
875<dd class="description">Name of variable</dd>
876<dt>value</dt>
877<dd class="description">Value of variable</dd>
878</dl>
879<h4 class="discussion">Discussion</h4>
880<p class="discussion">If the variable is an array, this truncates the array to a single element.</p>
881<h3 class="function"><a name="cgiShowIPPError">cgiShowIPPError</a></h3>
882<p class="description">Show the last IPP error message.</p>
883<p class="code">
884void cgiShowIPPError (<br>
885&nbsp;&nbsp;&nbsp;&nbsp;const char *message<br>
886);</p>
887<h4 class="parameters">Parameters</h4>
888<dl>
889<dt>message</dt>
890<dd class="description">Contextual message</dd>
891</dl>
892<h4 class="discussion">Discussion</h4>
893<p class="discussion">The caller must still call cgiStartHTML() and cgiEndHTML().</p>
894<h3 class="function"><a name="cgiShowJobs">cgiShowJobs</a></h3>
895<p class="description">Show print jobs.</p>
896<p class="code">
897void cgiShowJobs (<br>
898&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
899&nbsp;&nbsp;&nbsp;&nbsp;const char *dest<br>
900);</p>
901<h4 class="parameters">Parameters</h4>
902<dl>
903<dt>http</dt>
904<dd class="description">Connection to server</dd>
905<dt>dest</dt>
906<dd class="description">Destination name or NULL</dd>
907</dl>
908<h3 class="function"><a name="cgiStartHTML">cgiStartHTML</a></h3>
909<p class="description">Start a HTML page.</p>
910<p class="code">
911void cgiStartHTML (<br>
912&nbsp;&nbsp;&nbsp;&nbsp;const char *title<br>
913);</p>
914<h4 class="parameters">Parameters</h4>
915<dl>
916<dt>title</dt>
917<dd class="description">Title of page</dd>
918</dl>
919<h3 class="function"><a name="cgiStartMultipart">cgiStartMultipart</a></h3>
920<p class="description">Start a multipart delivery of a web page.</p>
921<p class="code">
922void cgiStartMultipart (void);</p>
923<h3 class="function"><a name="cgiSupportsMultipart">cgiSupportsMultipart</a></h3>
924<p class="description">Does the browser support multi-part documents?</p>
925<p class="code">
926int cgiSupportsMultipart (void);</p>
927<h4 class="returnvalue">Return Value</h4>
928<p class="description">1 if multi-part supported, 0 otherwise</p>
929<h3 class="function"><a name="cgiText">cgiText</a></h3>
930<p class="description">Return localized text.</p>
931<p class="code">
932const char *cgiText (<br>
933&nbsp;&nbsp;&nbsp;&nbsp;const char *message<br>
934);</p>
935<h4 class="parameters">Parameters</h4>
936<dl>
937<dt>message</dt>
938<dd class="description">Message</dd>
939</dl>
940<h4 class="returnvalue">Return Value</h4>
941<p class="description">Localized message</p>
942<h3 class="function"><a name="helpDeleteIndex">helpDeleteIndex</a></h3>
943<p class="description">Delete an index, freeing all memory used.</p>
944<p class="code">
945void helpDeleteIndex (<br>
946&nbsp;&nbsp;&nbsp;&nbsp;<a href="#help_index_t">help_index_t</a> *hi<br>
947);</p>
948<h4 class="parameters">Parameters</h4>
949<dl>
950<dt>hi</dt>
951<dd class="description">Help index</dd>
952</dl>
953<h3 class="function"><a name="helpFindNode">helpFindNode</a></h3>
954<p class="description">Find a node in an index.</p>
955<p class="code">
956<a href="#help_node_t">help_node_t</a> *helpFindNode (<br>
957&nbsp;&nbsp;&nbsp;&nbsp;<a href="#help_index_t">help_index_t</a> *hi,<br>
958&nbsp;&nbsp;&nbsp;&nbsp;const char *filename,<br>
959&nbsp;&nbsp;&nbsp;&nbsp;const char *anchor<br>
960);</p>
961<h4 class="parameters">Parameters</h4>
962<dl>
963<dt>hi</dt>
964<dd class="description">Index</dd>
965<dt>filename</dt>
966<dd class="description">Filename</dd>
967<dt>anchor</dt>
968<dd class="description">Anchor</dd>
969</dl>
970<h4 class="returnvalue">Return Value</h4>
971<p class="description">Node pointer or NULL</p>
972<h3 class="function"><a name="helpLoadIndex">helpLoadIndex</a></h3>
973<p class="description">Load a help index from disk.</p>
974<p class="code">
975<a href="#help_index_t">help_index_t</a> *helpLoadIndex (<br>
976&nbsp;&nbsp;&nbsp;&nbsp;const char *hifile,<br>
977&nbsp;&nbsp;&nbsp;&nbsp;const char *directory<br>
978);</p>
979<h4 class="parameters">Parameters</h4>
980<dl>
981<dt>hifile</dt>
982<dd class="description">Index filename</dd>
983<dt>directory</dt>
984<dd class="description">Directory that is indexed</dd>
985</dl>
986<h4 class="returnvalue">Return Value</h4>
987<p class="description">Index pointer or NULL</p>
988<h3 class="function"><a name="helpSaveIndex">helpSaveIndex</a></h3>
989<p class="description">Save a help index to disk.</p>
990<p class="code">
991int helpSaveIndex (<br>
992&nbsp;&nbsp;&nbsp;&nbsp;<a href="#help_index_t">help_index_t</a> *hi,<br>
993&nbsp;&nbsp;&nbsp;&nbsp;const char *hifile<br>
994);</p>
995<h4 class="parameters">Parameters</h4>
996<dl>
997<dt>hi</dt>
998<dd class="description">Index</dd>
999<dt>hifile</dt>
1000<dd class="description">Index filename</dd>
1001</dl>
1002<h4 class="returnvalue">Return Value</h4>
1003<p class="description">0 on success, -1 on error</p>
1004<h3 class="function"><a name="helpSearchIndex">helpSearchIndex</a></h3>
1005<p class="description">Search an index.</p>
1006<p class="code">
1007<a href="#help_index_t">help_index_t</a> *helpSearchIndex (<br>
1008&nbsp;&nbsp;&nbsp;&nbsp;<a href="#help_index_t">help_index_t</a> *hi,<br>
1009&nbsp;&nbsp;&nbsp;&nbsp;const char *query,<br>
1010&nbsp;&nbsp;&nbsp;&nbsp;const char *section,<br>
1011&nbsp;&nbsp;&nbsp;&nbsp;const char *filename<br>
1012);</p>
1013<h4 class="parameters">Parameters</h4>
1014<dl>
1015<dt>hi</dt>
1016<dd class="description">Index</dd>
1017<dt>query</dt>
1018<dd class="description">Query string</dd>
1019<dt>section</dt>
1020<dd class="description">Limit search to this section</dd>
1021<dt>filename</dt>
1022<dd class="description">Limit search to this file</dd>
1023</dl>
1024<h4 class="returnvalue">Return Value</h4>
1025<p class="description">Search index</p>
1026<h2 class="title"><a name="TYPES">Data Types</a></h2>
1027<h3 class="typedef"><a name="cgi_file_t">cgi_file_t</a></h3>
1028<p class="description">Uploaded file data</p>
1029<p class="code">
1030typedef struct <a href="#cgi_file_s">cgi_file_s</a> cgi_file_t;
1031</p>
1032<h3 class="typedef"><a name="help_index_t">help_index_t</a></h3>
1033<p class="description">Help index structure</p>
1034<p class="code">
1035typedef struct <a href="#help_index_s">help_index_s</a> help_index_t;
1036</p>
1037<h3 class="typedef"><a name="help_node_t">help_node_t</a></h3>
1038<p class="description">Help node structure...</p>
1039<p class="code">
1040typedef struct <a href="#help_node_s">help_node_s</a> help_node_t;
1041</p>
1042<h3 class="typedef"><a name="help_word_t">help_word_t</a></h3>
1043<p class="description">Help word structure...</p>
1044<p class="code">
1045typedef struct <a href="#help_word_s">help_word_s</a> help_word_t;
1046</p>
1047<h2 class="title"><a name="STRUCTURES">Structures</a></h2>
1048<h3 class="struct"><a name="cgi_file_s">cgi_file_s</a></h3>
1049<p class="description">Uploaded file data</p>
1050<p class="code">struct cgi_file_s {<br>
1051&nbsp;&nbsp;&nbsp;&nbsp;size_t filesize;<br>
1052&nbsp;&nbsp;&nbsp;&nbsp;char tempfile[1024], *name, *filename, *mimetype;<br>
1053};</p>
1054<h4 class="members">Members</h4>
1055<dl>
1056<dt>filesize </dt>
1057<dd class="description">Size of uploaded file</dd>
1058<dt>mimetype </dt>
1059<dd class="description">MIME media type</dd>
1060</dl>
1061<h3 class="struct"><a name="help_index_s">help_index_s</a></h3>
1062<p class="description">Help index structure</p>
1063<p class="code">struct help_index_s {<br>
1064&nbsp;&nbsp;&nbsp;&nbsp;cups_array_t *nodes;<br>
1065&nbsp;&nbsp;&nbsp;&nbsp;int search;<br>
1066&nbsp;&nbsp;&nbsp;&nbsp;cups_array_t *sorted;<br>
1067};</p>
1068<h4 class="members">Members</h4>
1069<dl>
1070<dt>nodes </dt>
1071<dd class="description">Nodes sorted by filename</dd>
1072<dt>search </dt>
1073<dd class="description">1 = search index, 0 = normal</dd>
1074<dt>sorted </dt>
1075<dd class="description">Nodes sorted by score + text</dd>
1076</dl>
1077<h3 class="struct"><a name="help_node_s">help_node_s</a></h3>
1078<p class="description">Help node structure...</p>
1079<p class="code">struct help_node_s {<br>
1080&nbsp;&nbsp;&nbsp;&nbsp;char *anchor;<br>
1081&nbsp;&nbsp;&nbsp;&nbsp;char *filename;<br>
1082&nbsp;&nbsp;&nbsp;&nbsp;size_t length;<br>
1083&nbsp;&nbsp;&nbsp;&nbsp;time_t mtime;<br>
1084&nbsp;&nbsp;&nbsp;&nbsp;off_t offset;<br>
1085&nbsp;&nbsp;&nbsp;&nbsp;int score;<br>
1086&nbsp;&nbsp;&nbsp;&nbsp;char *section;<br>
1087&nbsp;&nbsp;&nbsp;&nbsp;char *text;<br>
1088&nbsp;&nbsp;&nbsp;&nbsp;cups_array_t *words;<br>
1089};</p>
1090<h4 class="members">Members</h4>
1091<dl>
1092<dt>anchor </dt>
1093<dd class="description">Anchor name (NULL if none)</dd>
1094<dt>filename </dt>
1095<dd class="description">Filename, relative to help dir</dd>
1096<dt>length </dt>
1097<dd class="description">Length in bytes</dd>
1098<dt>mtime </dt>
1099<dd class="description">Last modification time</dd>
1100<dt>offset </dt>
1101<dd class="description">Offset in file</dd>
1102<dt>score </dt>
1103<dd class="description">Search score</dd>
1104<dt>section </dt>
1105<dd class="description">Section name (NULL if none)</dd>
1106<dt>text </dt>
1107<dd class="description">Text in anchor</dd>
1108<dt>words </dt>
1109<dd class="description">Words after this node</dd>
1110</dl>
1111<h3 class="struct"><a name="help_word_s">help_word_s</a></h3>
1112<p class="description">Help word structure...</p>
1113<p class="code">struct help_word_s {<br>
1114&nbsp;&nbsp;&nbsp;&nbsp;int count;<br>
1115&nbsp;&nbsp;&nbsp;&nbsp;char *text;<br>
1116};</p>
1117<h4 class="members">Members</h4>
1118<dl>
1119<dt>count </dt>
1120<dd class="description">Number of occurrences</dd>
1121<dt>text </dt>
1122<dd class="description">Word text</dd>
1123</dl>
1124</div>
1125</body>
1126</html>