CHANGES IN CUPS V1.1.19
+ - Implicit classes are now created from identical
+ printer classes on the network.
- The lp command now supports a "-H restart" option to
restart previously printed jobs. This functionality
only works if you have enabled the PreserveJobFiles
/*
- * "$Id: classes.c,v 1.44 2002/12/17 19:00:14 swdev Exp $"
+ * "$Id: classes.c,v 1.45 2003/01/24 17:55:05 mike Exp $"
*
* Printer class routines for the Common UNIX Printing System (CUPS).
*
FindClass(const char *name) /* I - Name of class */
{
printer_t *c; /* Current class/printer */
+ int diff; /* Difference */
for (c = Printers; c != NULL; c = c->next)
- switch (strcasecmp(name, c->name))
- {
- case 0 : /* name == c->name */
- if (c->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
- return (c);
- case 1 : /* name > c->name */
- break;
- case -1 : /* name < c->name */
- return (NULL);
- }
+ if ((diff = strcasecmp(name, c->name)) == 0 &&
+ (c->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT)))
+ return (c); /* name == c->name */
+ else if (diff < 0) /* name < c->name */
+ return (NULL);
return (NULL);
}
/*
- * End of "$Id: classes.c,v 1.44 2002/12/17 19:00:14 swdev Exp $".
+ * End of "$Id: classes.c,v 1.45 2003/01/24 17:55:05 mike Exp $".
*/
/*
- * "$Id: dirsvc.c,v 1.104 2003/01/15 04:15:49 mike Exp $"
+ * "$Id: dirsvc.c,v 1.105 2003/01/24 17:55:05 mike Exp $"
*
* Directory services routines for the Common UNIX Printing System (CUPS).
*
next = p->next;
/*
- * Skip classes...
+ * Skip implicit classes...
*/
- if (p->type & (CUPS_PRINTER_IMPLICIT | CUPS_PRINTER_CLASS))
+ if (p->type & CUPS_PRINTER_IMPLICIT)
{
len = 0;
continue;
* we have a class, and if this printer is a member...
*/
- if ((pclass = FindPrinter(name)) == NULL)
+ if ((pclass = FindDest(name)) == NULL)
{
/*
* Need to add the class...
name[len] = '\0';
offset = 0;
- if ((pclass = FindPrinter(name)) != NULL &&
+ if ((pclass = FindDest(name)) != NULL &&
!(pclass->type & CUPS_PRINTER_IMPLICIT))
{
/*
* the "ImplicitAnyClasses"...
*/
- if (ImplicitAnyClasses)
+ if (ImplicitAnyClasses && len < (sizeof(name) - 4))
{
/*
* Add "Any" to the class name...
/*
- * End of "$Id: dirsvc.c,v 1.104 2003/01/15 04:15:49 mike Exp $".
+ * End of "$Id: dirsvc.c,v 1.105 2003/01/24 17:55:05 mike Exp $".
*/
/*
- * "$Id: printers.c,v 1.134 2002/12/17 19:00:18 swdev Exp $"
+ * "$Id: printers.c,v 1.135 2003/01/24 17:55:06 mike Exp $"
*
* Printer routines for the Common UNIX Printing System (CUPS).
*
}
+/*
+ * 'FindDest()' - Find a destination in the list.
+ */
+
+printer_t * /* O - Destination in list */
+FindDest(const char *name) /* I - Name of printer or class to find */
+{
+ printer_t *p; /* Current destination */
+ int diff; /* Difference */
+
+
+ for (p = Printers; p != NULL; p = p->next)
+ if ((diff = strcasecmp(name, p->name)) == 0)/* name == p->name */
+ return (p);
+ else if (diff < 0) /* name < p->name */
+ return (NULL);
+
+ return (NULL);
+}
+
+
/*
* 'FindPrinter()' - Find a printer in the list.
*/
FindPrinter(const char *name) /* I - Name of printer to find */
{
printer_t *p; /* Current printer */
+ int diff; /* Difference */
for (p = Printers; p != NULL; p = p->next)
- switch (strcasecmp(name, p->name))
- {
- case 0 : /* name == p->name */
- if (!(p->type & CUPS_PRINTER_CLASS))
- return (p);
- case 1 : /* name > p->name */
- break;
- case -1 : /* name < p->name */
- return (NULL);
- }
+ if ((diff = strcasecmp(name, p->name)) == 0 &&
+ !(p->type & CUPS_PRINTER_CLASS)) /* name == p->name */
+ return (p);
+ else if (diff < 0) /* name < p->name */
+ return (NULL);
return (NULL);
}
/*
- * End of "$Id: printers.c,v 1.134 2002/12/17 19:00:18 swdev Exp $".
+ * End of "$Id: printers.c,v 1.135 2003/01/24 17:55:06 mike Exp $".
*/
/*
- * "$Id: printers.h,v 1.27 2002/12/17 19:00:18 swdev Exp $"
+ * "$Id: printers.h,v 1.28 2003/01/24 17:55:06 mike Exp $"
*
* Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
*
extern void DeleteAllPrinters(void);
extern void DeletePrinter(printer_t *p);
extern void DeletePrinterFilters(printer_t *p);
+extern printer_t *FindDest(const char *name);
extern printer_t *FindPrinter(const char *name);
extern quota_t *FindQuota(printer_t *p, const char *username);
extern void FreePrinterUsers(printer_t *p);
/*
- * End of "$Id: printers.h,v 1.27 2002/12/17 19:00:18 swdev Exp $".
+ * End of "$Id: printers.h,v 1.28 2003/01/24 17:55:06 mike Exp $".
*/