]>
git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/jobs.c
287072e808c32679d47a1dfc9cd775aa6c773414
2 * "$Id: jobs.c,v 1.15 2001/01/22 15:03:22 mike Exp $"
4 * Job status CGI for the Common UNIX Printing System (CUPS).
6 * Copyright 1997-2001 by Easy Software Products.
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636-3111 USA
20 * Voice: (301) 373-9603
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
26 * main() - Main entry for CGI.
30 * Include necessary headers...
37 * 'main()' - Main entry for CGI.
40 int /* O - Exit status */
41 main(int argc
, /* I - Number of command-line arguments */
42 char *argv
[]) /* I - Command-line arguments */
44 cups_lang_t
*language
; /* Language information */
45 http_t
*http
; /* Connection to the server */
46 const char *which_jobs
; /* Which jobs to show */
47 ipp_t
*request
, /* IPP request */
48 *response
; /* IPP response */
52 * Get any form variables...
58 * Get the request language...
61 language
= cupsLangDefault();
64 * Connect to the HTTP server...
67 http
= httpConnect("localhost", ippPort());
70 * Tell the client to expect HTML...
73 printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language
));
75 cgiSetVariable("TITLE", "Jobs");
77 ippSetServerVersion();
79 cgiCopyTemplateLang(stdout
, TEMPLATES
, "header.tmpl", getenv("LANG"));
82 * Build an IPP_GET_JOBS request, which requires the following
86 * attributes-natural-language
92 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_CHARSET
,
93 "attributes-charset", NULL
, cupsLangEncoding(language
));
95 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_LANGUAGE
,
96 "attributes-natural-language", NULL
, language
->language
);
98 request
->request
.op
.operation_id
= IPP_GET_JOBS
;
99 request
->request
.op
.request_id
= 1;
101 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_URI
, "job-uri", NULL
,
102 "ipp://localhost/jobs");
104 if ((which_jobs
= cgiGetVariable("which_jobs")) != NULL
)
105 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_KEYWORD
, "which-jobs",
109 * Do the request and get back a response...
112 if ((response
= cupsDoRequest(http
, request
, "/")) != NULL
)
114 ippSetCGIVars(response
, NULL
, NULL
);
117 cgiCopyTemplateLang(stdout
, TEMPLATES
, "jobs.tmpl", getenv("LANG"));
120 cgiCopyTemplateLang(stdout
, TEMPLATES
, "trailer.tmpl", getenv("LANG"));
123 * Close the HTTP server connection...
127 cupsLangFree(language
);
130 * Return with no errors...
138 * End of "$Id: jobs.c,v 1.15 2001/01/22 15:03:22 mike Exp $".