MCPcopy Create free account
hub / github.com/OpenPrinting/cups / main

Function main

cgi-bin/classes.c:33–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 */
32
33int /* O - Exit status */
34main(void)
35{
36 const char *pclass; /* Class name */
37 const char *user; /* Username */
38 http_t *http; /* Connection to the server */
39 ipp_t *request, /* IPP request */
40 *response; /* IPP response */
41 ipp_attribute_t *attr; /* IPP attribute */
42 const char *op; /* Operation to perform, if any */
43 static const char *def_attrs[] = /* Attributes for default printer */
44 {
45 "printer-name",
46 "printer-uri-supported"
47 };
48
49
50 /*
51 * Get any form variables...
52 */
53
54 cgiInitialize();
55
56 op = cgiGetVariable("OP");
57
58 /*
59 * Set the web interface section...
60 */
61
62 cgiSetVariable("SECTION", "classes");
63 cgiSetVariable("REFRESH_PAGE", "");
64
65 /*
66 * See if we are displaying a printer or all classes...
67 */
68
69 if ((pclass = getenv("PATH_INFO")) != NULL)
70 {
71 pclass ++;
72
73 if (!*pclass)
74 pclass = NULL;
75
76 if (pclass)
77 cgiSetVariable("PRINTER_NAME", pclass);
78 }
79
80 /*
81 * See who is logged in...
82 */
83
84 user = getenv("REMOTE_USER");
85
86 /*
87 * Connect to the HTTP server...
88 */
89
90 http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());

Callers

nothing calls this directly

Calls 15

cgiInitializeFunction · 0.85
cgiGetVariableFunction · 0.85
cgiSetVariableFunction · 0.85
httpConnectEncryptFunction · 0.85
cupsServerFunction · 0.85
ippPortFunction · 0.85
cupsEncryptionFunction · 0.85
cgiIsPOSTFunction · 0.85
ippNewRequestFunction · 0.85
ippAddStringsFunction · 0.85
cupsDoRequestFunction · 0.85
ippFindAttributeFunction · 0.85

Tested by

no test coverage detected