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