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

Function main

cgi-bin/admin.c:55–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 */
54
55int /* O - Exit status */
56main(void)
57{
58 http_t *http; /* Connection to the server */
59 const char *op; /* Operation name */
60
61
62 /*
63 * Connect to the HTTP server...
64 */
65
66 fputs("DEBUG: admin.cgi started...\n", stderr);
67
68 http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
69
70 if (!http)
71 {
72 perror("ERROR: Unable to connect to cupsd");
73 fprintf(stderr, "DEBUG: cupsServer()=\"%s\"\n",
74 cupsServer() ? cupsServer() : "(null)");
75 fprintf(stderr, "DEBUG: ippPort()=%d\n", ippPort());
76 fprintf(stderr, "DEBUG: cupsEncryption()=%d\n", cupsEncryption());
77 exit(1);
78 }
79
80 fprintf(stderr, "DEBUG: http=%p\n", http);
81
82 /*
83 * Set the web interface section...
84 */
85
86 cgiSetVariable("SECTION", "admin");
87 cgiSetVariable("REFRESH_PAGE", "");
88
89 /*
90 * See if we have form data...
91 */
92
93 if (!cgiInitialize() || !cgiGetVariable("OP"))
94 {
95 /*
96 * Nope, send the administration menu...
97 */
98
99 fputs("DEBUG: No form data, showing main menu...\n", stderr);
100
101 do_menu(http);
102 }
103 else if ((op = cgiGetVariable("OP")) != NULL && cgiIsPOST())
104 {
105 /*
106 * Do the operation...
107 */
108
109 fprintf(stderr, "DEBUG: op=\"%s\"...\n", op);
110
111 if (!*op)
112 {

Callers

nothing calls this directly

Calls 15

httpConnectEncryptFunction · 0.85
cupsServerFunction · 0.85
ippPortFunction · 0.85
cupsEncryptionFunction · 0.85
cgiSetVariableFunction · 0.85
cgiInitializeFunction · 0.85
cgiGetVariableFunction · 0.85
do_menuFunction · 0.85
cgiIsPOSTFunction · 0.85
httpAssembleURIfFunction · 0.85
httpAssembleURIFunction · 0.85
do_set_allowed_usersFunction · 0.85

Tested by

no test coverage detected