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