1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3 <!-- SECTION: Programming -->
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">
9 <style type=
"text/css"><!--
11 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
14 H1, H2, H3, H4, H5, H6, P, TD, TH {
15 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
19 font-family: monaco, courier, monospace;
24 font-family: monaco, courier, monospace;
28 border: dotted thin #7f7f7f;
44 border: dotted thin #999999;
49 PRE.command EM, PRE.example EM {
50 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
54 font-family: monaco, courier, monospace;
65 border: solid thin #999999;
76 -moz-border-radius: 10px;
81 text-decoration: none;
84 A:link:hover, A:visited:hover, A:active {
85 text-decoration: underline;
92 TR.data, TD.data, TR.data TD {
95 border-bottom: solid 1pt #999999;
99 border-bottom: solid 1pt #999999;
106 border: solid thin #999999;
107 border-collapse: collapse;
123 border: solid thin #cccccc;
130 border-bottom: solid thin #999999;
139 caption-side: bottom;
163 border: thin solid black;
171 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
180 border-bottom: solid 2pt #000000;
183 DIV.indent, TABLE.indent {
191 border-collapse: collapse;
194 TABLE.indent TD, TABLE.indent TH {
199 border-collapse: collapse;
207 border-bottom: solid thin #cccccc;
212 vertical-align: bottom;
221 border-bottom: solid thin #eeeeee;
226 TABLE.list TR:nth-child(even) {
230 TABLE.list TR:nth-child(odd) {
249 font-family: monaco, courier, monospace;
253 border: solid thin #999999;
254 border-collapse: collapse;
259 DIV.summary TABLE TD, DIV.summary TABLE TH {
260 border: solid thin #999999;
266 DIV.summary TABLE THEAD TH {
270 /* API documentation styles... */
277 div.body h3, div.body h4, div.body h5 {
278 margin-bottom: 0.5em;
281 .class, .enumeration, .function, .struct, .typedef, .union {
282 border-bottom: solid thin #999999;
289 code, p.code, pre, ul.code li {
290 font-family: monaco, courier, monospace;
293 ul.code, ul.contents, ul.subcontents {
294 list-style-type: none;
304 ul.contents li ul.code, ul.contents li ul.subcontents {
317 margin-bottom: 0.5em;
320 /* This is just for the HTML files generated with the framedhelp target */
323 border: solid thin black;
332 div.contents ul.contents {
335 div.contents ul.subcontents li {
346 CGI API header for CUPS.
348 Copyright 2009 by Apple Inc.
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/".
357 <h1 class='title'
>CGI API
</h1>
359 <div class='summary'
><table summary='General Information'
>
373 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a></td>
377 <h2 class=
"title">Contents
</h2>
378 <ul class=
"contents">
379 <li><a href=
"#OVERVIEW">Overview
</a></li>
380 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
381 <li><a href=
"#cgiCheckVariables" title=
"Check for the presence of "required" 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
385 '{variable}' strings with the variable value.">cgiCopyTemplateFile
</a></li>
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
394 by the template file.">cgiGetAttributes
</a></li>
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 "database".">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>
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>
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>
442 CGI API introduction for CUPS.
444 Copyright 2009 by Apple Inc.
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/".
453 <h2 class='title'
><a name='OVERVIEW'
>Overview
</a></h2>
455 <p>The CGI API provides Common Gateway Interface functions for CUPS.
</p>
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
"required
" variables.
</p>
460 int cgiCheckVariables (
<br>
461 const char *names
<br>
463 <h4 class=
"parameters">Parameters
</h4>
466 <dd class=
"description">Variables to look for
</dd>
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>
472 <h3 class=
"function"><a name=
"cgiClearVariables">cgiClearVariables
</a></h3>
473 <p class=
"description">Clear all form variables.
</p>
475 void cgiClearVariables (void);
</p>
476 <h3 class=
"function"><a name=
"cgiCompileSearch">cgiCompileSearch
</a></h3>
477 <p class=
"description">Compile a search string.
</p>
479 void *cgiCompileSearch (
<br>
480 const char *query
<br>
482 <h4 class=
"parameters">Parameters
</h4>
485 <dd class=
"description">Query string
</dd>
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>
493 void cgiCopyTemplateFile (
<br>
494 FILE *out,
<br>
495 const char *tmpl
<br>
497 <h4 class=
"parameters">Parameters
</h4>
500 <dd class=
"description">Output file
</dd>
502 <dd class=
"description">Template file to read
</dd>
504 <h3 class=
"function"><a name=
"cgiCopyTemplateLang">cgiCopyTemplateLang
</a></h3>
505 <p class=
"description">Copy a template file using a language...
</p>
507 void cgiCopyTemplateLang (
<br>
508 const char *tmpl
<br>
510 <h4 class=
"parameters">Parameters
</h4>
513 <dd class=
"description">Base filename
</dd>
515 <h3 class=
"function"><a name=
"cgiDoSearch">cgiDoSearch
</a></h3>
516 <p class=
"description">Do a search of some text.
</p>
518 int cgiDoSearch (
<br>
519 void *search,
<br>
520 const char *text
<br>
522 <h4 class=
"parameters">Parameters
</h4>
525 <dd class=
"description">Search context
</dd>
527 <dd class=
"description">Text to search
</dd>
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>
534 void 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>
538 void 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>
542 char *cgiFormEncode (
<br>
543 char *dst,
<br>
544 const char *src,
<br>
545 size_t dstsize
<br>
547 <h4 class=
"parameters">Parameters
</h4>
550 <dd class=
"description">Destination string
</dd>
552 <dd class=
"description">Source string
</dd>
554 <dd class=
"description">Size of destination string
</dd>
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>
561 void cgiFreeSearch (
<br>
562 void *search
<br>
564 <h4 class=
"parameters">Parameters
</h4>
567 <dd class=
"description">Search context
</dd>
569 <h3 class=
"function"><a name=
"cgiGetArray">cgiGetArray
</a></h3>
570 <p class=
"description">Get an element from a form array.
</p>
572 const char *cgiGetArray (
<br>
573 const char *name,
<br>
574 int element
<br>
576 <h4 class=
"parameters">Parameters
</h4>
579 <dd class=
"description">Name of array variable
</dd>
581 <dd class=
"description">Element number (
0 to N)
</dd>
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
587 by the template file.
</p>
589 void cgiGetAttributes (
<br>
590 ipp_t *request,
<br>
591 const char *tmpl
<br>
593 <h4 class=
"parameters">Parameters
</h4>
596 <dd class=
"description">IPP request
</dd>
598 <dd class=
"description">Base filename
</dd>
600 <h3 class=
"function"><a name=
"cgiGetCookie">cgiGetCookie
</a></h3>
601 <p class=
"description">Get a cookie value.
</p>
603 const char *cgiGetCookie (
<br>
604 const char *name
<br>
606 <h4 class=
"parameters">Parameters
</h4>
609 <dd class=
"description">Name of cookie
</dd>
611 <h4 class=
"returnvalue">Return Value
</h4>
612 <p class=
"description">Value or NULL
</p>
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>
616 const
<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>
622 cups_array_t *cgiGetIPPObjects (
<br>
623 ipp_t *response,
<br>
624 void *search
<br>
626 <h4 class=
"parameters">Parameters
</h4>
629 <dd class=
"description">IPP response
</dd>
631 <dd class=
"description">Search filter
</dd>
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>
639 const char *name
<br>
641 <h4 class=
"parameters">Parameters
</h4>
644 <dd class=
"description">Name of variable
</dd>
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>
651 char *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>
655 <p class=
"description">Get a CGI variable from the database.
</p>
657 const char *cgiGetVariable (
<br>
658 const char *name
<br>
660 <h4 class=
"parameters">Parameters
</h4>
663 <dd class=
"description">Name of variable
</dd>
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
669 array of values, returns the last element.
</p>
670 <h3 class=
"function"><a name=
"cgiInitialize">cgiInitialize
</a></h3>
671 <p class=
"description">Initialize the CGI variable
"database
".
</p>
673 int 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>
679 int 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>
685 void cgiMoveJobs (
<br>
686 http_t *http,
<br>
687 const char *dest,
<br>
688 int job_id
<br>
690 <h4 class=
"parameters">Parameters
</h4>
693 <dd class=
"description">Connection to server
</dd>
695 <dd class=
"description">Destination or NULL
</dd>
697 <dd class=
"description">Job ID or
0 for all
</dd>
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>
704 void cgiPrintCommand (
<br>
705 http_t *http,
<br>
706 const char *dest,
<br>
707 const char *command,
<br>
708 const char *title
<br>
710 <h4 class=
"parameters">Parameters
</h4>
713 <dd class=
"description">Connection to server
</dd>
715 <dd class=
"description">Destination printer
</dd>
717 <dd class=
"description">Command to send
</dd>
719 <dd class=
"description">Page/job title
</dd>
721 <h3 class=
"function"><a name=
"cgiPrintTestPage">cgiPrintTestPage
</a></h3>
722 <p class=
"description">Print a test page.
</p>
724 void cgiPrintTestPage (
<br>
725 http_t *http,
<br>
726 const char *dest
<br>
728 <h4 class=
"parameters">Parameters
</h4>
731 <dd class=
"description">Connection to server
</dd>
733 <dd class=
"description">Destination printer/class
</dd>
735 <h3 class=
"function"><a name=
"cgiRewriteURL">cgiRewriteURL
</a></h3>
736 <p class=
"description">Rewrite a printer URI into a web browser URL...
</p>
738 char *cgiRewriteURL (
<br>
739 const char *uri,
<br>
740 char *url,
<br>
741 int urlsize,
<br>
742 const char *newresource
<br>
744 <h4 class=
"parameters">Parameters
</h4>
747 <dd class=
"description">Current URI
</dd>
749 <dd class=
"description">New URL
</dd>
751 <dd class=
"description">Size of URL buffer
</dd>
753 <dd class=
"description">Replacement resource
</dd>
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>
760 void cgiSetArray (
<br>
761 const char *name,
<br>
762 int element,
<br>
763 const char *value
<br>
765 <h4 class=
"parameters">Parameters
</h4>
768 <dd class=
"description">Name of variable
</dd>
770 <dd class=
"description">Element number (
0 to N)
</dd>
772 <dd class=
"description">Value of variable
</dd>
774 <h4 class=
"discussion">Discussion
</h4>
775 <p class=
"discussion">If the variable array is smaller than (element +
1), the intervening
776 elements are set to NULL.
</p>
777 <h3 class=
"function"><a name=
"cgiSetCookie">cgiSetCookie
</a></h3>
778 <p class=
"description">Set a cookie value.
</p>
780 void cgiSetCookie (
<br>
781 const char *name,
<br>
782 const char *value,
<br>
783 const char *path,
<br>
784 const char *domain,
<br>
785 time_t expires,
<br>
786 int secure
<br>
788 <h4 class=
"parameters">Parameters
</h4>
791 <dd class=
"description">Name
</dd>
793 <dd class=
"description">Value
</dd>
795 <dd class=
"description">Path (typically
"/
")
</dd>
797 <dd class=
"description">Domain name
</dd>
799 <dd class=
"description">Expiration date (
0 for session)
</dd>
801 <dd class=
"description">Require SSL
</dd>
803 <h3 class=
"function"><a name=
"cgiSetIPPObjectVars">cgiSetIPPObjectVars
</a></h3>
804 <p class=
"description">Set CGI variables from an IPP object.
</p>
806 ipp_attribute_t *cgiSetIPPObjectVars (
<br>
807 ipp_attribute_t *obj,
<br>
808 const char *prefix,
<br>
809 int element
<br>
811 <h4 class=
"parameters">Parameters
</h4>
814 <dd class=
"description">Response data to be copied...
</dd>
816 <dd class=
"description">Prefix for name or NULL
</dd>
818 <dd class=
"description">Parent element number
</dd>
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>
825 int cgiSetIPPVars (
<br>
826 ipp_t *response,
<br>
827 const char *filter_name,
<br>
828 const char *filter_value,
<br>
829 const char *prefix,
<br>
830 int parent_el
<br>
832 <h4 class=
"parameters">Parameters
</h4>
835 <dd class=
"description">Response data to be copied...
</dd>
837 <dd class=
"description">Filter name
</dd>
838 <dt>filter_value
</dt>
839 <dd class=
"description">Filter value
</dd>
841 <dd class=
"description">Prefix for name or NULL
</dd>
843 <dd class=
"description">Parent element number
</dd>
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>
850 void cgiSetServerVersion (void);
</p>
851 <h3 class=
"function"><a name=
"cgiSetSize">cgiSetSize
</a></h3>
852 <p class=
"description">Set the array size.
</p>
854 void cgiSetSize (
<br>
855 const char *name,
<br>
856 int size
<br>
858 <h4 class=
"parameters">Parameters
</h4>
861 <dd class=
"description">Name of variable
</dd>
863 <dd class=
"description">Number of elements (
0 to N)
</dd>
865 <h3 class=
"function"><a name=
"cgiSetVariable">cgiSetVariable
</a></h3>
866 <p class=
"description">Set a CGI variable in the database.
</p>
868 void cgiSetVariable (
<br>
869 const char *name,
<br>
870 const char *value
<br>
872 <h4 class=
"parameters">Parameters
</h4>
875 <dd class=
"description">Name of variable
</dd>
877 <dd class=
"description">Value of variable
</dd>
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>
884 void cgiShowIPPError (
<br>
885 const char *message
<br>
887 <h4 class=
"parameters">Parameters
</h4>
890 <dd class=
"description">Contextual message
</dd>
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>
897 void cgiShowJobs (
<br>
898 http_t *http,
<br>
899 const char *dest
<br>
901 <h4 class=
"parameters">Parameters
</h4>
904 <dd class=
"description">Connection to server
</dd>
906 <dd class=
"description">Destination name or NULL
</dd>
908 <h3 class=
"function"><a name=
"cgiStartHTML">cgiStartHTML
</a></h3>
909 <p class=
"description">Start a HTML page.
</p>
911 void cgiStartHTML (
<br>
912 const char *title
<br>
914 <h4 class=
"parameters">Parameters
</h4>
917 <dd class=
"description">Title of page
</dd>
919 <h3 class=
"function"><a name=
"cgiStartMultipart">cgiStartMultipart
</a></h3>
920 <p class=
"description">Start a multipart delivery of a web page.
</p>
922 void 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>
926 int 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>
932 const char *cgiText (
<br>
933 const char *message
<br>
935 <h4 class=
"parameters">Parameters
</h4>
938 <dd class=
"description">Message
</dd>
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>
945 void helpDeleteIndex (
<br>
946 <a href=
"#help_index_t">help_index_t
</a> *hi
<br>
948 <h4 class=
"parameters">Parameters
</h4>
951 <dd class=
"description">Help index
</dd>
953 <h3 class=
"function"><a name=
"helpFindNode">helpFindNode
</a></h3>
954 <p class=
"description">Find a node in an index.
</p>
956 <a href=
"#help_node_t">help_node_t
</a> *helpFindNode (
<br>
957 <a href=
"#help_index_t">help_index_t
</a> *hi,
<br>
958 const char *filename,
<br>
959 const char *anchor
<br>
961 <h4 class=
"parameters">Parameters
</h4>
964 <dd class=
"description">Index
</dd>
966 <dd class=
"description">Filename
</dd>
968 <dd class=
"description">Anchor
</dd>
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>
975 <a href=
"#help_index_t">help_index_t
</a> *helpLoadIndex (
<br>
976 const char *hifile,
<br>
977 const char *directory
<br>
979 <h4 class=
"parameters">Parameters
</h4>
982 <dd class=
"description">Index filename
</dd>
984 <dd class=
"description">Directory that is indexed
</dd>
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>
991 int helpSaveIndex (
<br>
992 <a href=
"#help_index_t">help_index_t
</a> *hi,
<br>
993 const char *hifile
<br>
995 <h4 class=
"parameters">Parameters
</h4>
998 <dd class=
"description">Index
</dd>
1000 <dd class=
"description">Index filename
</dd>
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>
1007 <a href=
"#help_index_t">help_index_t
</a> *helpSearchIndex (
<br>
1008 <a href=
"#help_index_t">help_index_t
</a> *hi,
<br>
1009 const char *query,
<br>
1010 const char *section,
<br>
1011 const char *filename
<br>
1013 <h4 class=
"parameters">Parameters
</h4>
1016 <dd class=
"description">Index
</dd>
1018 <dd class=
"description">Query string
</dd>
1020 <dd class=
"description">Limit search to this section
</dd>
1022 <dd class=
"description">Limit search to this file
</dd>
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>
1030 typedef struct
<a href=
"#cgi_file_s">cgi_file_s
</a> cgi_file_t;
1032 <h3 class=
"typedef"><a name=
"help_index_t">help_index_t
</a></h3>
1033 <p class=
"description">Help index structure
</p>
1035 typedef struct
<a href=
"#help_index_s">help_index_s
</a> help_index_t;
1037 <h3 class=
"typedef"><a name=
"help_node_t">help_node_t
</a></h3>
1038 <p class=
"description">Help node structure...
</p>
1040 typedef struct
<a href=
"#help_node_s">help_node_s
</a> help_node_t;
1042 <h3 class=
"typedef"><a name=
"help_word_t">help_word_t
</a></h3>
1043 <p class=
"description">Help word structure...
</p>
1045 typedef struct
<a href=
"#help_word_s">help_word_s
</a> help_word_t;
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 size_t filesize;
<br>
1052 char tempfile[
1024], *name, *filename, *mimetype;
<br>
1054 <h4 class=
"members">Members
</h4>
1057 <dd class=
"description">Size of uploaded file
</dd>
1059 <dd class=
"description">MIME media type
</dd>
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 cups_array_t *nodes;
<br>
1065 int search;
<br>
1066 cups_array_t *sorted;
<br>
1068 <h4 class=
"members">Members
</h4>
1071 <dd class=
"description">Nodes sorted by filename
</dd>
1073 <dd class=
"description">1 = search index,
0 = normal
</dd>
1075 <dd class=
"description">Nodes sorted by score + text
</dd>
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 char *anchor;
<br>
1081 char *filename;
<br>
1082 size_t length;
<br>
1083 time_t mtime;
<br>
1084 off_t offset;
<br>
1085 int score;
<br>
1086 char *section;
<br>
1087 char *text;
<br>
1088 cups_array_t *words;
<br>
1090 <h4 class=
"members">Members
</h4>
1093 <dd class=
"description">Anchor name (NULL if none)
</dd>
1095 <dd class=
"description">Filename, relative to help dir
</dd>
1097 <dd class=
"description">Length in bytes
</dd>
1099 <dd class=
"description">Last modification time
</dd>
1101 <dd class=
"description">Offset in file
</dd>
1103 <dd class=
"description">Search score
</dd>
1105 <dd class=
"description">Section name (NULL if none)
</dd>
1107 <dd class=
"description">Text in anchor
</dd>
1109 <dd class=
"description">Words after this node
</dd>
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 int count;
<br>
1115 char *text;
<br>
1117 <h4 class=
"members">Members
</h4>
1120 <dd class=
"description">Number of occurrences
</dd>
1122 <dd class=
"description">Word text
</dd>