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

Function cupsPrintFiles2

cups/util.c:773–886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

771 */
772
773int /* O - Job ID or 0 on error */
774cupsPrintFiles2(
775 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
776 const char *name, /* I - Destination name */
777 int num_files, /* I - Number of files */
778 const char **files, /* I - File(s) to print */
779 const char *title, /* I - Title of job */
780 int num_options, /* I - Number of options */
781 cups_option_t *options) /* I - Options */
782{
783 int i; /* Looping var */
784 int job_id; /* New job ID */
785 const char *docname; /* Basename of current filename */
786 const char *format; /* Document format */
787 cups_file_t *fp; /* Current file */
788 char buffer[8192]; /* Copy buffer */
789 ssize_t bytes; /* Bytes in buffer */
790 http_status_t status; /* Status of write */
791 _cups_globals_t *cg = _cupsGlobals(); /* Global data */
792 ipp_status_t cancel_status; /* Status code to preserve */
793 char *cancel_message; /* Error message to preserve */
794
795
796 DEBUG_printf(("cupsPrintFiles2(http=%p, name=\"%s\", num_files=%d, files=%p, title=\"%s\", num_options=%d, options=%p)", (void *)http, name, num_files, (void *)files, title, num_options, (void *)options));
797
798 /*
799 * Range check input...
800 */
801
802 if (!name || num_files < 1 || !files)
803 {
804 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
805
806 return (0);
807 }
808
809 /*
810 * Create the print job...
811 */
812
813 if ((job_id = cupsCreateJob(http, name, title, num_options, options)) == 0)
814 return (0);
815
816 /*
817 * Send each of the files...
818 */
819
820 if (cupsGetOption("raw", num_options, options))
821 format = CUPS_FORMAT_RAW;
822 else if ((format = cupsGetOption("document-format", num_options,
823 options)) == NULL)
824 format = CUPS_FORMAT_AUTO;
825
826 for (i = 0; i < num_files; i ++)
827 {
828 /*
829 * Start the next file...
830 */

Callers 3

cupsPrintFileFunction · 0.85
cupsPrintFile2Function · 0.85
cupsPrintFilesFunction · 0.85

Calls 12

_cupsGlobalsFunction · 0.85
_cupsSetErrorFunction · 0.85
cupsCreateJobFunction · 0.85
cupsGetOptionFunction · 0.85
cupsFileOpenFunction · 0.85
cupsStartDocumentFunction · 0.85
cupsFileReadFunction · 0.85
cupsWriteRequestDataFunction · 0.85
cupsFileCloseFunction · 0.85
cupsFinishDocumentFunction · 0.85
_cupsStrRetainFunction · 0.85
cupsCancelJob2Function · 0.85

Tested by

no test coverage detected