#
-# "$Id: Makefile,v 1.15 2000/02/08 20:38:41 mike Exp $"
+# "$Id: Makefile,v 1.16 2000/02/11 05:04:12 mike Exp $"
#
# Backend makefile for the Common UNIX Printing System (CUPS).
#
include ../Makedefs
-TARGETS = betest ipp lpd parallel serial socket
-OBJS = betest.o ipp.o lpd.o parallel.o serial.o socket.o
+TARGETS = betest ipp lpd parallel serial socket usb
+OBJS = betest.o ipp.o lpd.o parallel.o serial.o socket.o usb.o
+
#
# Make all targets...
all: $(TARGETS)
+
#
# Clean all object files...
#
clean:
rm -f $(OBJS) $(TARGETS)
+
#
# Install all targets...
#
$(CP) $(TARGETS) $(SERVERBIN)/backend
-$(LN) ipp $(SERVERBIN)/backend/http
+
#
# betest
#
betest.o: ../cups/string.h ../Makedefs
+
#
# ipp
#
ipp.o: ../cups/cups.h ../Makedefs
+
#
# lpd
#
lpd.o: ../cups/cups.h ../Makedefs
+
#
# parallel
#
parallel.o: ../cups/cups.h ../Makedefs
+
#
# serial
#
serial.o: ../cups/cups.h ../Makedefs
+
#
# socket
#
socket.o: ../cups/cups.h ../Makedefs
+
+#
+# usb
+#
+
+usb: usb.o ../cups/$(LIBCUPS)
+ echo Linking $@...
+ $(CC) $(LDFLAGS) -o usb usb.o $(LIBS)
+
+usb.o: ../cups/cups.h ../Makedefs
+
+
#
-# End of "$Id: Makefile,v 1.15 2000/02/08 20:38:41 mike Exp $".
+# End of "$Id: Makefile,v 1.16 2000/02/11 05:04:12 mike Exp $".
#
/*
- * "$Id: parallel.c,v 1.13 2000/02/10 00:57:52 mike Exp $"
+ * "$Id: parallel.c,v 1.14 2000/02/11 05:04:12 mike Exp $"
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
list_devices(void)
{
#ifdef __linux
- int i; /* Looping var */
- int fd; /* File descriptor */
- char device[255]; /* Device filename */
+ int i; /* Looping var */
+ int fd; /* File descriptor */
+ char device[255]; /* Device filename */
+ FILE *probe; /* /proc/parport/n/autoprobe file */
+ char line[1024], /* Line from file */
+ *delim, /* Delimiter in file */
+ make[IPP_MAX_NAME], /* Make from file */
+ model[IPP_MAX_NAME]; /* Model from file */
for (i = 0; i < 4; i ++)
{
- sprintf(device, "/dev/lp%d", i);
- if ((fd = open(device, O_WRONLY)) >= 0)
+ sprintf(device, "/proc/parport/%d/autoprobe", i);
+ if ((probe = fopen(device, "r")) != NULL)
{
- close(fd);
- printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
+ memset(make, 0, sizeof(make));
+ memset(model, 0, sizeof(model));
+ strcpy(model, "Unknown");
+
+ while (fgets(line, sizeof(line), probe) != NULL)
+ {
+ /*
+ * Strip trailing ; and/or newline.
+ */
+
+ if ((delim = strrchr(line, ';')) != NULL)
+ *delim = '\0';
+ else if ((delim = strrchr(line, '\n')) != NULL)
+ *delim = '\0';
+
+ /*
+ * Look for MODEL and MANUFACTURER lines...
+ */
+
+ if (strncmp(line, "MODEL:", 6) == 0 &&
+ strncmp(line, "MODEL:Unknown", 13) != 0)
+ strncpy(model, line + 6, sizeof(model) - 1);
+ else if (strncmp(line, "MANUFACTURER:", 13) == 0 &&
+ strncmp(line, "MANUFACTURER:Unknown", 20) != 0)
+ strncpy(make, line + 13, sizeof(make) - 1);
+ }
+
+ fclose(probe);
+
+ if (make[0])
+ printf("direct parallel:/dev/lp%d \"%s %s\" \"Parallel Port #%d\"\n",
+ i, make, model, i + 1);
+ else
+ printf("direct parallel:/dev/lp%d \"%s\" \"Parallel Port #%d\"\n",
+ i, model, i + 1);
}
else
{
- sprintf(device, "/dev/par%d", i);
+ sprintf(device, "/dev/lp%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
}
+ else
+ {
+ sprintf(device, "/dev/par%d", i);
+ if ((fd = open(device, O_WRONLY)) >= 0)
+ {
+ close(fd);
+ printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
+ }
+ }
}
}
#elif defined(__sgi)
/*
- * End of "$Id: parallel.c,v 1.13 2000/02/10 00:57:52 mike Exp $".
+ * End of "$Id: parallel.c,v 1.14 2000/02/11 05:04:12 mike Exp $".
*/
--- /dev/null
+/*
+ * "$Id: usb.c,v 1.1 2000/02/11 05:04:12 mike Exp $"
+ *
+ * USB port backend for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 1997-2000 by Easy Software Products, all rights reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636-3111 USA
+ *
+ * Voice: (301) 373-9603
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ * main() - Send a file to the specified USB port.
+ * list_devices() - List all USB devices.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include <cups/cups.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <cups/string.h>
+
+#if defined(WIN32) || defined(__EMX__)
+# include <io.h>
+#else
+# include <unistd.h>
+# include <fcntl.h>
+# include <termios.h>
+#endif /* WIN32 || __EMX__ */
+
+
+/*
+ * Local functions...
+ */
+
+void list_devices(void);
+
+
+/*
+ * 'main()' - Send a file to the specified USB port.
+ *
+ * Usage:
+ *
+ * printer-uri job-id user title copies options [file]
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments (6 or 7) */
+ char *argv[]) /* I - Command-line arguments */
+{
+ char method[255], /* Method in URI */
+ hostname[1024], /* Hostname */
+ username[255], /* Username info (not used) */
+ resource[1024], /* Resource info (device and options) */
+ *options; /* Pointer to options */
+ int port; /* Port number (not used) */
+ FILE *fp; /* Print file */
+ int copies; /* Number of copies to print */
+ int fd; /* Parallel device */
+ int error; /* Error code (if any) */
+ size_t nbytes, /* Number of bytes written */
+ tbytes; /* Total number of bytes written */
+ char buffer[8192]; /* Output buffer */
+ struct termios opts; /* Parallel port options */
+
+
+ if (argc == 1)
+ {
+ list_devices();
+ return (0);
+ }
+ else if (argc < 6 || argc > 7)
+ {
+ fputs("Usage: USB job-id user title copies options [file]\n", stderr);
+ return (1);
+ }
+
+ /*
+ * If we have 7 arguments, print the file named on the command-line.
+ * Otherwise, send stdin instead...
+ */
+
+ if (argc == 6)
+ {
+ fp = stdin;
+ copies = 1;
+ }
+ else
+ {
+ /*
+ * Try to open the print file...
+ */
+
+ if ((fp = fopen(argv[6], "rb")) == NULL)
+ {
+ perror("ERROR: unable to open print file");
+ return (1);
+ }
+
+ copies = atoi(argv[4]);
+ }
+
+ /*
+ * Extract the device name and options from the URI...
+ */
+
+ httpSeparate(argv[0], method, username, hostname, &port, resource);
+
+ /*
+ * See if there are any options...
+ */
+
+ if ((options = strchr(resource, '?')) != NULL)
+ {
+ /*
+ * Yup, terminate the device name string and move to the first
+ * character of the options...
+ */
+
+ *options++ = '\0';
+ }
+
+ /*
+ * Open the USB port device...
+ */
+
+ if ((fd = open(resource, O_WRONLY)) == -1)
+ {
+ perror("ERROR: Unable to open USB port device file");
+ return (1);
+ }
+
+ /*
+ * Set any options provided...
+ */
+
+ tcgetattr(fd, &opts);
+
+ opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
+
+ /**** No options supported yet ****/
+
+ tcsetattr(fd, TCSANOW, &opts);
+
+ /*
+ * Finally, send the print file...
+ */
+
+ while (copies > 0)
+ {
+ copies --;
+
+ if (fp != stdin)
+ {
+ fputs("PAGE: 1 1\n", stderr);
+ rewind(fp);
+ }
+
+ tbytes = 0;
+ while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
+ {
+ /*
+ * Write the print data to the printer...
+ */
+
+ if (write(fd, buffer, nbytes) < nbytes)
+ {
+ perror("ERROR: Unable to send print file to printer");
+ break;
+ }
+ else
+ tbytes += nbytes;
+
+ if (argc > 6)
+ fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
+ }
+ }
+
+ /*
+ * Close the socket connection and input file and return...
+ */
+
+ close(fd);
+ if (fp != stdin)
+ fclose(fp);
+
+ return (0);
+}
+
+
+/*
+ * 'list_devices()' - List all USB devices.
+ */
+
+void
+list_devices(void)
+{
+#ifdef __linux
+ int i; /* Looping var */
+ int is_printer; /* Printer device? */
+ int fd; /* File descriptor */
+ char device[255]; /* Device filename */
+ FILE *probe; /* /proc/parport/n/autoprobe file */
+ char line[1024], /* Line from file */
+ *delim, /* Delimiter in file */
+ make[IPP_MAX_NAME], /* Make from file */
+ model[IPP_MAX_NAME]; /* Model from file */
+
+
+ if ((probe = fopen("/proc/bus/usb/devices", "r")) != NULL)
+ {
+ i = 0;
+ is_printer = 0;
+
+ memset(make, 0, sizeof(make));
+ memset(model, 0, sizeof(model));
+
+ while (fgets(line, sizeof(line), probe) != NULL)
+ {
+ /*
+ * Strip trailing newline.
+ */
+
+ if ((delim = strrchr(line, '\n')) != NULL)
+ *delim = '\0';
+
+ /*
+ * See if it is a printer device ("P: ...")
+ */
+
+ if (strncmp(line, "S:", 2) == 0 && is_printer)
+ {
+ /*
+ * String attribute...
+ */
+
+ if (strncmp(line, "S: Manufacturer=", 17) == 0)
+ strncpy(make, line + 17, sizeof(make) - 1);
+ else if (strncmp(line, "S: Product=", 12) == 0)
+ strncpy(model, line + 12, sizeof(model) - 1);
+ }
+ else if (is_printer)
+ {
+ /*
+ * We were processing a printer device; send the info out...
+ */
+
+ if (make[0])
+ printf("direct usb:/dev/usblp%d \"%s %s\" \"USB Printer #%d\"\n",
+ i, make, model, i + 1);
+ else if (model[0])
+ printf("direct usb:/dev/usblp%d \"%s\" \"USB Printer #%d\"\n",
+ i, model, i + 1);
+ else
+ printf("direct usb:/dev/usblp%d \"Unknown\" \"USB Printer #%d\"\n",
+ i, i + 1);
+
+ is_printer = strncmp(line, "P:", 2) == 0;
+ i ++;
+
+ memset(make, 0, sizeof(make));
+ memset(model, 0, sizeof(model));
+ }
+ }
+
+ if (is_printer)
+ {
+ /*
+ * We were processing a printer device; send the info out...
+ */
+
+ if (make[0])
+ printf("direct usb:/dev/usblp%d \"%s %s\" \"USB Printer #%d\"\n",
+ i, make, model, i + 1);
+ else if (model[0])
+ printf("direct usb:/dev/usblp%d \"%s\" \"USB Printer #%d\"\n",
+ i, model, i + 1);
+ else
+ printf("direct usb:/dev/usblp%d \"Unknown\" \"USB Printer #%d\"\n",
+ i, i + 1);
+ }
+
+ fclose(probe);
+ }
+ else
+ {
+ for (i = 0; i < 8; i ++)
+ {
+ sprintf(device, "/dev/usblp%d", i);
+ if ((fd = open(device, O_WRONLY)) >= 0)
+ {
+ close(fd);
+ printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
+ }
+ }
+ }
+#elif defined(__sgi)
+#elif defined(__sun)
+#elif defined(__hpux)
+#elif defined(__osf)
+#elif defined(FreeBSD) || defined(OpenBSD) || defined(NetBSD)
+#endif
+}
+
+
+/*
+ * End of "$Id: usb.c,v 1.1 2000/02/11 05:04:12 mike Exp $".
+ */
/*
- * "$Id: config.h.in,v 1.17 2000/02/08 20:38:40 mike Exp $"
+ * "$Id: config.h.in,v 1.18 2000/02/11 05:04:11 mike Exp $"
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
* Version of software...
*/
-#define CUPS_SVERSION "CUPS v1.1a6"
+#define CUPS_SVERSION "CUPS v1.1a7"
/*
* Where are files stored?
#undef HAVE_WAIT3
/*
- * End of "$Id: config.h.in,v 1.17 2000/02/08 20:38:40 mike Exp $".
+ * End of "$Id: config.h.in,v 1.18 2000/02/11 05:04:11 mike Exp $".
*/
#
-# "$Id: cups.list,v 1.45 2000/02/10 00:57:51 mike Exp $"
+# "$Id: cups.list,v 1.46 2000/02/11 05:04:11 mike Exp $"
#
# ESP Package Manager (EPM) file list for the Common UNIX Printing
# System (CUPS).
%vendor Easy Software Products
%license LICENSE.txt
%readme README.txt
-%version 1.1a6
+%version 1.1a7
%incompat printpro
%system all
f 0555 root sys /usr/lib/cups/backend/parallel backend/parallel
f 0555 root sys /usr/lib/cups/backend/serial backend/serial
f 0555 root sys /usr/lib/cups/backend/socket backend/socket
+f 0555 root sys /usr/lib/cups/backend/usb backend/usb
f 0500 root sys /usr/sbin/cupsd scheduler/cupsd
f 0555 root sys /usr/lib/cups/cgi-bin/admin.cgi cgi-bin/admin.cgi
f 0555 root sys /usr/lib/cups/cgi-bin/classes.cgi cgi-bin/classes.cgi
i 0555 root sys cups cups.sh
#
-# End of "$Id: cups.list,v 1.45 2000/02/10 00:57:51 mike Exp $".
+# End of "$Id: cups.list,v 1.46 2000/02/11 05:04:11 mike Exp $".
#
#
-# "$Id: cups.spec,v 1.12 2000/02/08 20:38:40 mike Exp $"
+# "$Id: cups.spec,v 1.13 2000/02/11 05:04:11 mike Exp $"
#
# RPM "spec" file for the Common UNIX Printing System (CUPS).
#
Summary: Common Unix Printing System
Name: cups
-Version: 1.1a6
+Version: 1.1a7
Release: 0
Copyright: GPL
Group: System Environment/Daemons
/usr/lib/*.a
#
-# End of "$Id: cups.spec,v 1.12 2000/02/08 20:38:40 mike Exp $".
+# End of "$Id: cups.spec,v 1.13 2000/02/11 05:04:11 mike Exp $".
#
#
-# "$Id: Makefile,v 1.24 2000/02/08 20:38:56 mike Exp $"
+# "$Id: Makefile,v 1.25 2000/02/11 05:04:13 mike Exp $"
#
# Filter makefile for the Common UNIX Printing System (CUPS).
#
IMAGEOBJS = image-colorspace.o image-photocd.o image-sgilib.o \
image-tiff.o image-gif.o image-png.o image-sgi.o image-zoom.o \
image-jpeg.o image-pnm.o image-sun.o image.o
-OBJS = $(HPGLOBJS) $(IMAGEOBJS) imagetops.o imagetoraster.o \
- common.o pstops.o raster.o rastertoepson.o rastertohp.o \
- texttops.o textcommon.o
+FORMOBJS = form-attr.o form-main.o form-ps.o form-text.o form-tree.o
+OBJS = $(HPGLOBJS) $(IMAGEOBJS) $(FORMOBJS) \
+ imagetops.o imagetoraster.o common.o pstops.o raster.o \
+ rastertoepson.o rastertohp.o texttops.o textcommon.o
+
#
# Make all targets...
all: $(TARGETS)
+
#
# Clean all object files...
#
clean:
rm -f $(OBJS) $(TARGETS) $(LIBCUPSIMAGE)
+
#
# Install all targets...
#
$(LN) $(LIBCUPSIMAGE) `basename $(LIBCUPSIMAGE) .1`; \
fi
+
+#
+# formtops
+#
+
+formtops: $(FORMOBJS) common.o ../Makedefs ../cups/$(LIBCUPS)
+ echo Linking $@...
+ $(CC) $(LDFLAGS) -o $@ $(FORMOBJS) common.o $(LIBS) -lm
+$(FORMOBJS): form.h
+
+
#
# hpgltops
#
$(CC) $(LDFLAGS) -o $@ $(HPGLOBJS) common.o $(LIBS) -lm
$(HPGLOBJS): hpgltops.h
+
#
# libcupsimage.so.1, libcupsimage.sl.1
#
$(DSO) $@ $(IMAGEOBJS) raster.o $(DSOLIBS) -lm
-$(LN) $@ `basename $@ .1`
+
#
# libcupsimage.a
#
$(IMAGEOBJS): image.h
raster.o: raster.h
+
#
# imagetops
#
$(IMGLIBS) $(LIBS)
imagetops: common.h image.h
+
#
# imagetoraster
#
$(IMGLIBS) $(LIBS)
imagetoraster: common.h image.h raster.h
+
#
# pstops
#
$(CC) $(LDFLAGS) -o $@ pstops.o common.o $(LIBS)
pstops.o: common.h
+
#
# rastertoepson
#
$(CC) $(LDFLAGS) -o $@ rastertoepson.o -L. -lcupsimage $(LIBS)
rastertoepson.o: raster.h
+
#
# rastertohp
#
$(CC) $(LDFLAGS) -o $@ rastertohp.o -L. -lcupsimage $(LIBS)
rastertohp.o: raster.h
+
#
# texttops
#
common.o: common.h
textcommon.o: textcommon.h common.h
+
+
$(OBJS): ../Makedefs ../cups/cups.h ../cups/ppd.h ../cups/language.h
+
#
-# End of "$Id: Makefile,v 1.24 2000/02/08 20:38:56 mike Exp $".
+# End of "$Id: Makefile,v 1.25 2000/02/11 05:04:13 mike Exp $".
#
--- /dev/null
+/*
+ * "$Id: form-attr.c,v 1.1 2000/02/11 05:04:13 mike Exp $"
+ *
+ * CUPS form attribute routines for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 1997-2000 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636-3111 USA
+ *
+ * Voice: (301) 373-9603
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "form.h"
+
+
+/*
+ * End of "$Id: form-attr.c,v 1.1 2000/02/11 05:04:13 mike Exp $".
+ */
--- /dev/null
+/*
+ * "$Id: form-main.c,v 1.1 2000/02/11 05:04:13 mike Exp $"
+ *
+ * CUPS form main entry for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 1997-2000 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636-3111 USA
+ *
+ * Voice: (301) 373-9603
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "form.h"
+
+
+/*
+ * End of "$Id: form-main.c,v 1.1 2000/02/11 05:04:13 mike Exp $".
+ */
--- /dev/null
+/*
+ * "$Id: form-ps.c,v 1.1 2000/02/11 05:04:13 mike Exp $"
+ *
+ * CUPS form PostScript routines for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 1997-2000 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636-3111 USA
+ *
+ * Voice: (301) 373-9603
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "form.h"
+
+
+/*
+ * End of "$Id: form-ps.c,v 1.1 2000/02/11 05:04:13 mike Exp $".
+ */
--- /dev/null
+/*
+ * "$Id: form-text.c,v 1.1 2000/02/11 05:04:13 mike Exp $"
+ *
+ * CUPS form text routines for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 1997-2000 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636-3111 USA
+ *
+ * Voice: (301) 373-9603
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "form.h"
+
+
+/*
+ * End of "$Id: form-text.c,v 1.1 2000/02/11 05:04:13 mike Exp $".
+ */
--- /dev/null
+/*
+ * "$Id: form-tree.c,v 1.1 2000/02/11 05:04:13 mike Exp $"
+ *
+ * CUPS form document tree routines for the Common UNIX Printing
+ * System (CUPS).
+ *
+ * Copyright 1997-2000 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636-3111 USA
+ *
+ * Voice: (301) 373-9603
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "form.h"
+
+
+/*
+ * End of "$Id: form-tree.c,v 1.1 2000/02/11 05:04:13 mike Exp $".
+ */
--- /dev/null
+/*
+ * "$Id: form.h,v 1.1 2000/02/11 05:04:13 mike Exp $"
+ *
+ * CUPS form header file for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 1997-2000 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636-3111 USA
+ *
+ * Voice: (301) 373-9603
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "common.h"
+
+
+/*
+ * End of "$Id: form.h,v 1.1 2000/02/11 05:04:13 mike Exp $".
+ */
/*
- * "$Id: devices.c,v 1.2 2000/02/10 00:57:54 mike Exp $"
+ * "$Id: devices.c,v 1.3 2000/02/11 05:04:14 mike Exp $"
*
* Device scanning routines for the Common UNIX Printing System (CUPS).
*
#endif
+/*
+ * Device information structure...
+ */
+
+typedef struct
+{
+ char device_class[128], /* Device class */
+ device_make_and_model[128], /* Make and model, if known */
+ device_info[128], /* Device info/description */
+ device_uri[1024]; /* Device URI */
+} dev_info_t;
+
+
+/*
+ * Local globals...
+ */
+
+static int num_devs, /* Number of devices */
+ alloc_devs; /* Number of allocated entries */
+static dev_info_t *devs; /* Device info */
+
+
+/*
+ * Local functions...
+ */
+
+static int compare_devs(const dev_info_t *p0, const dev_info_t *p1);
+
+
/*
* 'LoadDevices()' - Load all available devices.
*/
void
LoadDevices(const char *d) /* I - Directory to scan */
{
+ int i; /* Looping var */
FILE *fp; /* Pipe to device backend */
DIR *dir; /* Directory pointer */
DIRENT *dent; /* Directory entry */
uri[1024], /* Device URI */
info[128], /* Device info */
make_model[256];/* Make and model */
+ dev_info_t *dev; /* Current device */
+
+ /*
+ * We always support the "file" device...
+ */
Devices = ippNew();
ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_URI,
"device-uri", NULL, "file");
+ /*
+ * Try opening the backend directory...
+ */
+
if ((dir = opendir(d)) == NULL)
{
LogMessage(L_ERROR, "LoadDevices: Unable to open backend directory \"%s\": %s",
return;
}
+ /*
+ * Setup the devices array...
+ */
+
+ alloc_devs = 0;
+ num_devs = 0;
+ devs = (dev_info_t *)0;
+
+ /*
+ * Loop through all of the device backends...
+ */
+
while ((dent = readdir(dir)) != NULL)
{
/*
else
{
/*
- * Add strings to attributes...
+ * Add the device to the array of available devices...
*/
- ippAddSeparator(Devices);
- ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "device-class", NULL, dclass);
- ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "device-info", NULL, info);
- ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "device-make-and-model", NULL, make_model);
- ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_URI,
- "device-uri", NULL, uri);
-
- LogMessage(L_DEBUG, "LoadDevices: Adding device \"%s\"...", uri);
+ if (num_devs >= alloc_devs)
+ {
+ /*
+ * Allocate (more) memory for the PPD files...
+ */
+
+ if (alloc_devs == 0)
+ dev = malloc(sizeof(dev_info_t) * 16);
+ else
+ dev = realloc(devs, sizeof(dev_info_t) * (alloc_devs + 16));
+
+ if (dev == NULL)
+ {
+ LogMessage(L_ERROR, "load_devs: Ran out of memory for %d devices!",
+ alloc_devs + 16);
+ closedir(dir);
+ return;
+ }
+
+ devs = dev;
+ alloc_devs += 16;
+ }
+
+ dev = devs + num_devs;
+ num_devs ++;
+
+ memset(dev, 0, sizeof(dev_info_t));
+ strncpy(dev->device_class, dclass, sizeof(dev->device_class) - 1);
+ strncpy(dev->device_info, info, sizeof(dev->device_info) - 1);
+ strncpy(dev->device_make_and_model, make_model,
+ sizeof(dev->device_make_and_model) - 1);
+ strncpy(dev->device_uri, uri, sizeof(dev->device_uri) - 1);
+
+ LogMessage(L_DEBUG, "LoadDevices: Added device \"%s\"...", uri);
}
}
}
closedir(dir);
+
+ /*
+ * Sort the available devices...
+ */
+
+ if (num_devs > 1)
+ qsort(devs, num_devs, sizeof(dev_info_t),
+ (int (*)(const void *, const void *))compare_devs);
+
+ /*
+ * Create the list of devices...
+ */
+
+ for (i = num_devs, dev = devs; i > 0; i --, dev ++)
+ {
+ /*
+ * Add strings to attributes...
+ */
+
+ ippAddSeparator(Devices);
+ ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "device-class", NULL, dev->device_class);
+ ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+ "device-info", NULL, dev->device_info);
+ ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+ "device-make-and-model", NULL, dev->device_make_and_model);
+ ippAddString(Devices, IPP_TAG_PRINTER, IPP_TAG_URI,
+ "device-uri", NULL, dev->device_uri);
+ }
+
+ /*
+ * Free the devices array...
+ */
+
+ if (alloc_devs)
+ free(devs);
+}
+
+
+/*
+ * 'compare_devs()' - Compare PPD file make and model names for sorting.
+ */
+
+static int /* O - Result of comparison */
+compare_devs(const dev_info_t *d0, /* I - First PPD file */
+ const dev_info_t *d1) /* I - Second PPD file */
+{
+ const char *s, /* First name */
+ *t; /* Second name */
+ int diff, /* Difference between digits */
+ digits; /* Number of digits */
+
+
+ /*
+ * First compare names...
+ */
+
+ s = d0->device_info;
+ t = d1->device_info;
+
+ /*
+ * Loop through both nicknames, returning only when a difference is
+ * seen. Also, compare whole numbers rather than just characters, too!
+ */
+
+ while (*s && *t)
+ {
+ if (isdigit(*s) && isdigit(*t))
+ {
+ /*
+ * Got a number; start by skipping leading 0's...
+ */
+
+ while (*s == '0')
+ s ++;
+ while (*t == '0')
+ t ++;
+
+ /*
+ * Skip equal digits...
+ */
+
+ while (isdigit(*s) && *s == *t)
+ {
+ s ++;
+ t ++;
+ }
+
+ /*
+ * Bounce out if *s and *t aren't both digits...
+ */
+
+ if (isdigit(*s) && !isdigit(*t))
+ return (1);
+ else if (!isdigit(*s) && isdigit(*t))
+ return (-1);
+ else if (!isdigit(*s) || !isdigit(*t))
+ continue;
+
+ if (*s < *t)
+ diff = -1;
+ else
+ diff = 1;
+
+ /*
+ * Figure out how many more digits there are...
+ */
+
+ digits = 0;
+ s ++;
+ t ++;
+
+ while (isdigit(*s))
+ {
+ digits ++;
+ s ++;
+ }
+
+ while (isdigit(*t))
+ {
+ digits --;
+ t ++;
+ }
+
+ /*
+ * Return if the number or value of the digits is different...
+ */
+
+ if (digits < 0)
+ return (-1);
+ else if (digits > 0)
+ return (1);
+ else if (diff)
+ return (diff);
+ }
+ else if (tolower(*s) < tolower(*t))
+ return (-1);
+ else if (tolower(*s) > tolower(*t))
+ return (1);
+ else
+ {
+ s ++;
+ t ++;
+ }
+ }
+
+ /*
+ * Return the results of the final comparison...
+ */
+
+ if (*s)
+ return (1);
+ else if (*t)
+ return (-1);
+ else if ((diff = strcasecmp(d0->device_class, d1->device_class)) != 0)
+ return (diff);
+ else
+ return (strcasecmp(d0->device_uri, d1->device_uri));
}
/*
- * End of "$Id: devices.c,v 1.2 2000/02/10 00:57:54 mike Exp $".
+ * End of "$Id: devices.c,v 1.3 2000/02/11 05:04:14 mike Exp $".
*/
/*
- * "$Id: dirsvc.c,v 1.47 2000/02/08 20:38:59 mike Exp $"
+ * "$Id: dirsvc.c,v 1.48 2000/02/11 05:04:14 mike Exp $"
*
* Directory services routines for the Common UNIX Printing System (CUPS).
*
method[HTTP_MAX_URI], /* Method portion of URI */
username[HTTP_MAX_URI], /* Username portion of URI */
host[HTTP_MAX_URI], /* Host portion of URI */
- resource[HTTP_MAX_URI]; /* Resource portion of URI */
+ resource[HTTP_MAX_URI], /* Resource portion of URI */
+ info[IPP_MAX_NAME], /* Information string */
+ location[IPP_MAX_NAME], /* Location string */
+ make_model[IPP_MAX_NAME];/* Make and model string */
int port; /* Port portion of URI */
char name[IPP_MAX_NAME], /* Name of printer */
*hptr, /* Pointer into hostname */
packet[bytes] = '\0';
#endif /* DEBUG */
- if (sscanf(packet, "%x%x%1023s", &type, &state, uri) != 3)
+ location[0] = '\0';
+ info[0] = '\0';
+ make_model[0] = '\0';
+
+ if (sscanf(packet,
+ "%x%x%1023s%*[^\"]\"%127[^\"]%*[^\"]\"%127[^\"]%*[^\"]\"%127[^\"]",
+ &type, &state, uri, location, info, make_model) < 3)
{
LogMessage(L_WARN, "UpdateBrowseList: Garbled browse packet - %s",
packet);
return;
}
- DEBUG_printf(("type=%x, state=%x, uri=\"%s\"\n", type, state, uri));
+ DEBUG_printf(("type=%x, state=%x, uri=\"%s\"\n"
+ "location=\"%s\", info=\"%s\", make_model=\"%s\"\n",
+ type, state, uri, location, info, make_model));
/*
* Pull the URI apart to see if this is a local or remote printer...
strcpy(p->uri, uri);
strcpy(p->device_uri, uri);
strcpy(p->hostname, host);
+
+ strcpy(p->location, "Location Unknown");
+ strcpy(p->info, "No Information Available");
+ snprintf(p->make_model, sizeof(p->make_model), "Remote Class on %s",
+ host);
+
SetPrinterAttrs(p);
}
}
strcpy(p->uri, uri);
strcpy(p->device_uri, uri);
strcpy(p->hostname, host);
+
+ strcpy(p->location, "Location Unknown");
+ strcpy(p->info, "No Information Available");
+ snprintf(p->make_model, sizeof(p->make_model), "Remote Printer on %s",
+ host);
+
SetPrinterAttrs(p);
}
}
p->accepting = state != IPP_PRINTER_STOPPED;
p->browse_time = time(NULL);
+ if (location[0])
+ strcpy(p->location, location);
+ if (info[0])
+ strcpy(p->info, info);
+ if (make_model[0])
+ strcpy(p->make_model, make_model);
+
/*
* See if we have a default printer... If not, make the first printer the
* default.
* we have a class, and if this printer is a member...
*/
- if ((pclass = FindClass(name)) == NULL)
+ if ((pclass = FindPrinter(name)) == NULL)
{
/*
* Need to add the class...
*/
- pclass = AddClass(name);
+ pclass = AddPrinter(name);
pclass->type |= CUPS_PRINTER_IMPLICIT;
pclass->accepting = 1;
pclass->state = IPP_PRINTER_IDLE;
name[len] = '\0';
offset = 0;
- if (FindPrinter(name) != NULL)
+ if ((pclass = FindPrinter(name)) != NULL &&
+ !(pclass->type & CUPS_PRINTER_IMPLICIT))
{
/*
* Can't use same name as printer; add "Any" to the front of the
time_t ut, /* Minimum update time */
to; /* Timeout time */
int bytes; /* Length of packet */
- char packet[1540];
+ char packet[1453];
/* Browse data packet */
p->browse_time = time(NULL);
- sprintf(packet, "%x %x %s\n", p->type | CUPS_PRINTER_REMOTE, p->state,
- p->uri);
+ snprintf(packet, sizeof(packet), "%x %x %s \"%s\" \"%s\" \"%s\"\n",
+ p->type | CUPS_PRINTER_REMOTE, p->state, p->uri,
+ p->location, p->info, p->make_model);
+
bytes = strlen(packet);
DEBUG_printf(("SendBrowseList: (%d bytes) %s", bytes, packet));
/*
- * End of "$Id: dirsvc.c,v 1.47 2000/02/08 20:38:59 mike Exp $".
+ * End of "$Id: dirsvc.c,v 1.48 2000/02/11 05:04:14 mike Exp $".
*/
/*
- * "$Id: job.c,v 1.53 2000/02/08 20:39:00 mike Exp $"
+ * "$Id: job.c,v 1.54 2000/02/11 05:04:14 mike Exp $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
{
job_t *current, /* Current job in queue */
*prev; /* Previous job in queue */
- printer_t *printer; /* Printer/class destination */
+ printer_t *printer, /* Printer destination */
+ *pclass; /* Printer class destination */
DEBUG_puts("CheckJobs()");
{
DEBUG_printf(("CheckJobs: current->dest = \'%s\'\n", current->dest));
- if (FindClass(current->dest) != NULL)
+ if ((pclass = FindClass(current->dest)) != NULL)
printer = FindAvailablePrinter(current->dest);
else
printer = FindPrinter(current->dest);
- if (printer == NULL && FindClass(current->dest) == NULL)
+ if (printer != NULL && (printer->type & CUPS_PRINTER_IMPLICIT))
+ {
+ /*
+ * Handle implicit classes...
+ */
+
+ pclass = printer;
+ printer = FindAvailablePrinter(current->dest);
+ }
+
+ if (printer == NULL && pclass == NULL)
{
/*
* Whoa, the printer and/or class for this destination went away;
/*
- * End of "$Id: job.c,v 1.53 2000/02/08 20:39:00 mike Exp $".
+ * End of "$Id: job.c,v 1.54 2000/02/11 05:04:14 mike Exp $".
*/
/*
- * "$Id: ppds.c,v 1.3 2000/02/10 00:57:54 mike Exp $"
+ * "$Id: ppds.c,v 1.4 2000/02/11 05:04:14 mike Exp $"
*
* PPD scanning routines for the Common UNIX Printing System (CUPS).
*
#endif
+/*
+ * PPD information structure...
+ */
+
+typedef struct
+{
+ char ppd_make[128], /* Manufacturer */
+ ppd_make_and_model[256], /* Make and model */
+ ppd_name[256], /* PPD filename */
+ ppd_natural_language[16]; /* Natural language */
+} ppd_info_t;
+
+
+/*
+ * Local globals...
+ */
+
+static int num_ppds, /* Number of PPD files */
+ alloc_ppds; /* Number of allocated entries */
+static ppd_info_t *ppds; /* PPD file info */
+
+
/*
* Local functions...
*/
+static int compare_ppds(const ppd_info_t *p0, const ppd_info_t *p1);
static void load_ppds(const char *d, const char *p);
void
LoadPPDs(const char *d) /* I - Directory to scan... */
{
- PPDs = ippNew();
+ int i; /* Looping var */
+ ppd_info_t *ppd; /* Current PPD file */
+
+
+ /*
+ * Load all PPDs in the specified directory and below...
+ */
+
+ num_ppds = 0;
+ alloc_ppds = 0;
+ ppds = (ppd_info_t *)0;
load_ppds(d, "");
+
+ /*
+ * Sort the PPDs...
+ */
+
+ if (num_ppds > 1)
+ qsort(ppds, num_ppds, sizeof(ppd_info_t),
+ (int (*)(const void *, const void *))compare_ppds);
+
+ /*
+ * Create the list of PPDs...
+ */
+
+ PPDs = ippNew();
+
+ for (i = num_ppds, ppd = ppds; i > 0; i --, ppd ++)
+ {
+ if (i)
+ ippAddSeparator(PPDs);
+
+ ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_NAME,
+ "ppd-name", NULL, ppd->ppd_name);
+ ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+ "ppd-make", NULL, ppd->ppd_make);
+ ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+ "ppd-make-and-model", NULL, ppd->ppd_make_and_model);
+ ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE,
+ "ppd-natural-language", NULL, ppd->ppd_natural_language);
+ }
+
+ /*
+ * Free the memory used...
+ */
+
+ if (alloc_ppds)
+ free(ppds);
+}
+
+
+/*
+ * 'compare_ppds()' - Compare PPD file make and model names for sorting.
+ */
+
+static int /* O - Result of comparison */
+compare_ppds(const ppd_info_t *p0, /* I - First PPD file */
+ const ppd_info_t *p1) /* I - Second PPD file */
+{
+ const char *s, /* First name */
+ *t; /* Second name */
+ int diff, /* Difference between digits */
+ digits; /* Number of digits */
+
+
+ /*
+ * First compare manufacturers...
+ */
+
+ if ((diff = strcasecmp(p0->ppd_make, p1->ppd_make)) != 0)
+ return (diff);
+
+ /*
+ * Then compare names...
+ */
+
+ s = p0->ppd_make_and_model;
+ t = p1->ppd_make_and_model;
+
+ /*
+ * Loop through both nicknames, returning only when a difference is
+ * seen. Also, compare whole numbers rather than just characters, too!
+ */
+
+ while (*s && *t)
+ {
+ if (isdigit(*s) && isdigit(*t))
+ {
+ /*
+ * Got a number; start by skipping leading 0's...
+ */
+
+ while (*s == '0')
+ s ++;
+ while (*t == '0')
+ t ++;
+
+ /*
+ * Skip equal digits...
+ */
+
+ while (isdigit(*s) && *s == *t)
+ {
+ s ++;
+ t ++;
+ }
+
+ /*
+ * Bounce out if *s and *t aren't both digits...
+ */
+
+ if (isdigit(*s) && !isdigit(*t))
+ return (1);
+ else if (!isdigit(*s) && isdigit(*t))
+ return (-1);
+ else if (!isdigit(*s) || !isdigit(*t))
+ continue;
+
+ if (*s < *t)
+ diff = -1;
+ else
+ diff = 1;
+
+ /*
+ * Figure out how many more digits there are...
+ */
+
+ digits = 0;
+ s ++;
+ t ++;
+
+ while (isdigit(*s))
+ {
+ digits ++;
+ s ++;
+ }
+
+ while (isdigit(*t))
+ {
+ digits --;
+ t ++;
+ }
+
+ /*
+ * Return if the number or value of the digits is different...
+ */
+
+ if (digits < 0)
+ return (-1);
+ else if (digits > 0)
+ return (1);
+ else if (diff)
+ return (diff);
+ }
+ else if (tolower(*s) < tolower(*t))
+ return (-1);
+ else if (tolower(*s) > tolower(*t))
+ return (1);
+ else
+ {
+ s ++;
+ t ++;
+ }
+ }
+
+ /*
+ * Return the results of the final comparison...
+ */
+
+ if (*s)
+ return (1);
+ else if (*t)
+ return (-1);
+ else
+ return (strcasecmp(p0->ppd_natural_language, p1->ppd_natural_language));
}
language[64], /* Device class */
manufacturer[1024], /* Manufacturer */
make_model[256]; /* Make and model */
+ ppd_info_t *ppd; /* New PPD file */
if ((dir = opendir(d)) == NULL)
* Add the PPD file...
*/
- if (PPDs->attrs)
- ippAddSeparator(PPDs);
+ if (num_ppds >= alloc_ppds)
+ {
+ /*
+ * Allocate (more) memory for the PPD files...
+ */
- ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_NAME,
- "ppd-name", NULL, name);
- ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "ppd-make", NULL, manufacturer);
- ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "ppd-make-and-model", NULL, make_model);
- ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE,
- "ppd-natural-language", NULL, language);
+ if (alloc_ppds == 0)
+ ppd = malloc(sizeof(ppd_info_t) * 32);
+ else
+ ppd = realloc(ppds, sizeof(ppd_info_t) * (alloc_ppds + 32));
+
+ if (ppd == NULL)
+ {
+ LogMessage(L_ERROR, "load_ppds: Ran out of memory for %d PPD files!",
+ alloc_ppds + 32);
+ closedir(dir);
+ return;
+ }
+
+ ppds = ppd;
+ alloc_ppds += 32;
+ }
+
+ ppd = ppds + num_ppds;
+ num_ppds ++;
+
+ memset(ppd, 0, sizeof(ppd_info_t));
+ strncpy(ppd->ppd_name, name, sizeof(ppd->ppd_name) - 1);
+ strncpy(ppd->ppd_make, manufacturer, sizeof(ppd->ppd_make) - 1);
+ strncpy(ppd->ppd_make_and_model, make_model,
+ sizeof(ppd->ppd_make_and_model) - 1);
+ strncpy(ppd->ppd_natural_language, language,
+ sizeof(ppd->ppd_natural_language) - 1);
- LogMessage(L_DEBUG, "LoadPPDs: Adding ppd \"%s\"...", name);
+ LogMessage(L_DEBUG, "LoadPPDs: Added ppd \"%s\"...", name);
}
closedir(dir);
/*
- * End of "$Id: ppds.c,v 1.3 2000/02/10 00:57:54 mike Exp $".
+ * End of "$Id: ppds.c,v 1.4 2000/02/11 05:04:14 mike Exp $".
*/
/*
- * "$Id: printers.c,v 1.53 2000/02/08 20:39:02 mike Exp $"
+ * "$Id: printers.c,v 1.54 2000/02/11 05:04:14 mike Exp $"
*
* Printer routines for the Common UNIX Printing System (CUPS).
*
* Tell the client this is a remote printer of some type...
*/
- if (p->type & CUPS_PRINTER_CLASS)
- snprintf(filename, sizeof(filename), "Remote Printer Class on %s",
- p->hostname);
- else
- snprintf(filename, sizeof(filename), "Remote Printer on %s", p->hostname);
-
ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "printer-make-and-model", NULL, filename);
+ "printer-make-and-model", NULL, p->make_model);
}
else
{
p->type &= ~CUPS_PRINTER_OPTIONS;
- if (p->type & CUPS_PRINTER_CLASS)
+ if (p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
{
/*
* Add class-specific attributes...
*/
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "printer-make-and-model", NULL, "Local Printer Class");
+ if ((p->type & CUPS_PRINTER_IMPLICIT) && p->num_printers > 0)
+ ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+ "printer-make-and-model", NULL, p->printers[0]->make_model);
+ else
+ ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+ "printer-make-and-model", NULL, "Local Printer Class");
if (p->num_printers > 0)
{
ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
"printer-make-and-model", NULL, ppd->nickname);
+ strncpy(p->make_model, ppd->nickname, sizeof(p->make_model) - 1);
+
/*
* Add media options from the PPD file...
*/
/*
- * End of "$Id: printers.c,v 1.53 2000/02/08 20:39:02 mike Exp $".
+ * End of "$Id: printers.c,v 1.54 2000/02/11 05:04:14 mike Exp $".
*/
/*
- * "$Id: printers.h,v 1.14 2000/01/04 13:46:10 mike Exp $"
+ * "$Id: printers.h,v 1.15 2000/02/11 05:04:14 mike Exp $"
*
* Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
*
hostname[HTTP_MAX_HOST],/* Host printer resides on */
name[IPP_MAX_NAME], /* Printer name */
location[IPP_MAX_NAME], /* Location code */
+ make_model[IPP_MAX_NAME],/* Make and model */
info[IPP_MAX_NAME], /* Description */
more_info[HTTP_MAX_URI];/* URL for site-specific info */
int accepting; /* Accepting jobs? */
/*
- * End of "$Id: printers.h,v 1.14 2000/01/04 13:46:10 mike Exp $".
+ * End of "$Id: printers.h,v 1.15 2000/02/11 05:04:14 mike Exp $".
*/
<TD ALIGN="RIGHT">Device:</TD>
<TD>
<SELECT NAME="DEVICE_URI">
- {[device_uri]<OPTION VALUE="{device_uri}" {?current_device_uri={device_uri}?SELECTED:}>{device_info}
+ {[device_uri]<OPTION VALUE="{device_uri}" {?current_device_uri={device_uri}?SELECTED:}>
+ {device_info} {?device_make_and_model!Unknown?({device_make_and_model}):}
}</SELECT>
</TD>
</TR>
Class State: {printer_state=3?idle:{printer_state=4?processing:stopped}},
{printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}.
{?printer_state_message=?:<BR><I>"{printer_state_message}"</I>}
+ {?member_names=?:<BR>Members: {member_names}}
<P>
<A HREF="/admin/?op=print-test-page&printer_name={printer_name}">
<IMG SRC="/images/print-test-page.gif" ALT="Print Test Page" BORDER="0"></A>
Printer State: {printer_state=3?idle:{printer_state=4?processing:stopped}},
{printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}.
{?printer_state_message=?:<BR><I>"{printer_state_message}"</I>}
+ {?device_uri=?:<BR>Device URI: {device_uri}}
<P>
<A HREF="/admin/?op=print-test-page&printer_name={printer_name}">
<IMG SRC="/images/print-test-page.gif" ALT="Print Test Page" BORDER="0"></A>