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

Function cupsdLoadAllClasses

scheduler/classes.c:260–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258 */
259
260void
261cupsdLoadAllClasses(void)
262{
263 int i; /* Looping var */
264 cups_file_t *fp; /* classes.conf file */
265 int linenum; /* Current line number */
266 char line[4096], /* Line from file */
267 *value, /* Pointer to value */
268 *valueptr; /* Pointer into value */
269 cupsd_printer_t *p, /* Current printer class */
270 *temp; /* Temporary pointer to printer */
271
272
273 /*
274 * Open the classes.conf file...
275 */
276
277 snprintf(line, sizeof(line), "%s/classes.conf", ServerRoot);
278 if ((fp = cupsdOpenConfFile(line)) == NULL)
279 return;
280
281 /*
282 * Read class configurations until we hit EOF...
283 */
284
285 linenum = 0;
286 p = NULL;
287
288 while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum))
289 {
290 /*
291 * Decode the directive...
292 */
293
294 if (!_cups_strcasecmp(line, "<Class") ||
295 !_cups_strcasecmp(line, "<DefaultClass"))
296 {
297 /*
298 * <Class name> or <DefaultClass name>
299 */
300
301 if (p == NULL && value)
302 {
303 cupsdLogMessage(CUPSD_LOG_DEBUG, "Loading class %s...", value);
304
305 /*
306 * Since prior classes may have implicitly defined this class,
307 * see if it already exists...
308 */
309
310 if ((p = cupsdFindDest(value)) != NULL)
311 {
312 p->type = CUPS_PRINTER_CLASS;
313 cupsdSetStringf(&p->uri, "ipp://%s:%d/classes/%s", ServerName,
314 LocalPort, value);
315 cupsdSetString(&p->error_policy, "retry-job");
316 }
317 else

Callers 1

cupsdReadConfigurationFunction · 0.85

Calls 15

cupsdOpenConfFileFunction · 0.85
cupsFileGetConfFunction · 0.85
_cups_strcasecmpFunction · 0.85
cupsdLogMessageFunction · 0.85
cupsdFindDestFunction · 0.85
cupsdSetStringfFunction · 0.85
cupsdSetStringFunction · 0.85
cupsdAddClassFunction · 0.85
cupsdSetPrinterAttrsFunction · 0.85
cupsdSetAuthInfoRequiredFunction · 0.85
cupsAddOptionFunction · 0.85
cupsdFindPrinterFunction · 0.85

Tested by

no test coverage detected