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

Function cgiPrintCommand

cgi-bin/ipp-var.c:521–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519 */
520
521void
522cgiPrintCommand(http_t *http, /* I - Connection to server */
523 const char *dest, /* I - Destination printer */
524 const char *command, /* I - Command to send */
525 const char *title) /* I - Page/job title */
526{
527 int job_id; /* Command file job */
528 char uri[HTTP_MAX_URI], /* Job URI */
529 resource[1024], /* Printer resource path */
530 refresh[1024], /* Refresh URL */
531 command_file[1024]; /* Command "file" */
532 http_status_t status; /* Document status */
533 cups_option_t hold_option; /* job-hold-until option */
534 const char *user; /* User name */
535 ipp_t *request, /* Get-Job-Attributes request */
536 *response; /* Get-Job-Attributes response */
537 ipp_attribute_t *attr; /* Current job attribute */
538 static const char * const job_attrs[] =/* Job attributes we want */
539 {
540 "job-state",
541 "job-printer-state-message"
542 };
543
544
545 /*
546 * Create the CUPS command file...
547 */
548
549 snprintf(command_file, sizeof(command_file), "#CUPS-COMMAND\n%s\n", command);
550
551 /*
552 * Show status...
553 */
554
555 if (cgiSupportsMultipart())
556 {
557 cgiStartMultipart();
558 cgiStartHTML(title);
559 cgiCopyTemplateLang("command.tmpl");
560 cgiEndHTML();
561 fflush(stdout);
562 }
563
564 /*
565 * Send the command file job...
566 */
567
568 hold_option.name = "job-hold-until";
569 hold_option.value = "no-hold";
570
571 if ((user = getenv("REMOTE_USER")) != NULL)
572 cupsSetUser(user);
573 else
574 cupsSetUser("anonymous");
575
576 if ((job_id = cupsCreateJob(http, dest, title,
577 1, &hold_option)) < 1)
578 {

Callers 2

mainFunction · 0.85
do_set_optionsFunction · 0.85

Calls 15

cgiSupportsMultipartFunction · 0.85
cgiStartMultipartFunction · 0.85
cgiStartHTMLFunction · 0.85
cgiCopyTemplateLangFunction · 0.85
cgiEndHTMLFunction · 0.85
cupsSetUserFunction · 0.85
cupsCreateJobFunction · 0.85
cgiSetVariableFunction · 0.85
cgiTextFunction · 0.85
cupsLastErrorStringFunction · 0.85
cgiEndMultipartFunction · 0.85
cupsStartDocumentFunction · 0.85

Tested by

no test coverage detected