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

Function cupsCreateJob

cups/util.c:151–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149 */
150
151int /* O - Job ID or 0 on error */
152cupsCreateJob(
153 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
154 const char *name, /* I - Destination name */
155 const char *title, /* I - Title of job */
156 int num_options, /* I - Number of options */
157 cups_option_t *options) /* I - Options */
158{
159 int job_id = 0; /* job-id value */
160 ipp_status_t status; /* Create-Job status */
161 cups_dest_t *dest; /* Destination */
162 cups_dinfo_t *info; /* Destination information */
163
164
165 DEBUG_printf(("cupsCreateJob(http=%p, name=\"%s\", title=\"%s\", num_options=%d, options=%p)", (void *)http, name, title, num_options, (void *)options));
166
167 /*
168 * Range check input...
169 */
170
171 if (!name)
172 {
173 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
174 return (0);
175 }
176
177 /*
178 * Lookup the destination...
179 */
180
181 if ((dest = cupsGetNamedDest(http, name, NULL)) == NULL)
182 {
183 DEBUG_puts("1cupsCreateJob: Destination not found.");
184 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOENT), 0);
185 return (0);
186 }
187
188 /*
189 * Query dest information and create the job...
190 */
191
192 DEBUG_puts("1cupsCreateJob: Querying destination info.");
193 if ((info = cupsCopyDestInfo(http, dest)) == NULL)
194 {
195 DEBUG_puts("1cupsCreateJob: Query failed.");
196 cupsFreeDests(1, dest);
197 return (0);
198 }
199
200 status = cupsCreateDestJob(http, dest, info, &job_id, title, num_options, options);
201 DEBUG_printf(("1cupsCreateJob: cupsCreateDestJob returned %04x (%s)", status, ippErrorString(status)));
202
203 cupsFreeDestInfo(info);
204 cupsFreeDests(1, dest);
205
206 /*
207 * Return the job...
208 */

Callers 5

mainFunction · 0.85
cgiPrintCommandFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
cupsPrintFiles2Function · 0.85

Calls 7

_cupsSetErrorFunction · 0.85
cupsGetNamedDestFunction · 0.85
cupsCopyDestInfoFunction · 0.85
cupsFreeDestsFunction · 0.85
cupsCreateDestJobFunction · 0.85
ippErrorStringFunction · 0.85
cupsFreeDestInfoFunction · 0.85

Tested by 1

mainFunction · 0.68