CHANGES IN CUPS V1.1.19
+ - The scheduler now supports print files that have been
+ compressed using gzip.
- The scheduler used the stdio functions to read any job
ticket information in a PostScript print job. Since
some platforms limit the number of stdio files to 256,
#
-# "$Id: cups.list.in,v 1.13.2.13 2003/03/19 15:37:44 mike Exp $"
+# "$Id: cups.list.in,v 1.13.2.14 2003/03/30 21:49:14 mike Exp $"
#
# ESP Package Manager (EPM) file list for the Common UNIX Printing
# System (CUPS).
f 0555 root sys $SERVERBIN/daemon/cups-lpd scheduler/cups-lpd
f 0555 root sys $SERVERBIN/daemon/cups-polld scheduler/cups-polld
d 0555 root sys $SERVERBIN/filter -
-f 0555 root sys $SERVERBIN/filter/pdftops pdftops/pdftops
+f 0555 root sys $SERVERBIN/filter/gziptoany filter/gziptoany
+f 0555 root sys $SERVERBIN/filter/hpgltops filter/hpgltops
f 0555 root sys $SERVERBIN/filter/imagetops filter/imagetops
+f 0555 root sys $SERVERBIN/filter/imagetoraster filter/imagetoraster
+f 0555 root sys $SERVERBIN/filter/pdftops pdftops/pdftops
f 0555 root sys $SERVERBIN/filter/pstops filter/pstops
-f 0555 root sys $SERVERBIN/filter/texttops filter/texttops
f 0555 root sys $SERVERBIN/filter/rastertodymo filter/rastertodymo
f 0555 root sys $SERVERBIN/filter/rastertoepson filter/rastertoepson
f 0555 root sys $SERVERBIN/filter/rastertohp filter/rastertohp
-f 0555 root sys $SERVERBIN/filter/hpgltops filter/hpgltops
-f 0555 root sys $SERVERBIN/filter/imagetoraster filter/imagetoraster
+f 0555 root sys $SERVERBIN/filter/texttops filter/texttops
# Admin commands
l 0555 root sys $BINDIR/disable $SBINDIR/accept
i 0555 root sys cups cups.sh
#
-# End of "$Id: cups.list.in,v 1.13.2.13 2003/03/19 15:37:44 mike Exp $".
+# End of "$Id: cups.list.in,v 1.13.2.14 2003/03/30 21:49:14 mike Exp $".
#
#
-# "$Id: Makefile,v 1.41.2.21 2003/01/07 18:26:50 mike Exp $"
+# "$Id: Makefile,v 1.41.2.22 2003/03/30 21:49:14 mike Exp $"
#
# Filter makefile for the Common UNIX Printing System (CUPS).
#
include ../Makedefs
-TARGETS = hpgltops texttops pstops imagetops imagetoraster \
- rastertodymo rastertoepson rastertohp rastertortl \
- testraster
+FILTERS = gziptoany hpgltops texttops pstops imagetops imagetoraster \
+ rastertodymo rastertoepson rastertohp rastertortl
+TARGETS = $(FILTERS) testraster
HPGLOBJS = hpgl-attr.o hpgl-config.o hpgl-main.o hpgl-prolog.o \
hpgl-char.o hpgl-input.o hpgl-polygon.o hpgl-vector.o
install: all installhdrs
$(INSTALL_DIR) $(SERVERBIN)/filter
- for file in $(TARGETS); do \
+ for file in $(FILTERS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/filter; \
done
$(INSTALL_DIR) $(LIBDIR)
$(CC) $(LDFLAGS) -o $@ $(FORMOBJS) common.o $(LIBS) -lm
+#
+# gziptoany
+#
+
+gziptoany: gziptoany.o
+ echo Linking $@...
+ $(CC) $(LDFLAGS) -o $@ gziptoany.o $(LIBZ)
+
+
#
# hpgltops
#
#
-# End of "$Id: Makefile,v 1.41.2.21 2003/01/07 18:26:50 mike Exp $".
+# End of "$Id: Makefile,v 1.41.2.22 2003/03/30 21:49:14 mike Exp $".
#
/*
- * "$Id: gziptoany.c,v 1.1 2003/03/30 21:43:00 mike Exp $"
+ * "$Id: gziptoany.c,v 1.1.2.1 2003/03/30 21:49:14 mike Exp $"
*
* GZIP pre-filter for the Common UNIX Printing System (CUPS).
*
/*
- * End of "$Id: gziptoany.c,v 1.1 2003/03/30 21:43:00 mike Exp $".
+ * End of "$Id: gziptoany.c,v 1.1.2.1 2003/03/30 21:49:14 mike Exp $".
*/
/*
- * "$Id: banners.c,v 1.5.2.4 2003/01/07 18:27:15 mike Exp $"
+ * "$Id: banners.c,v 1.5.2.5 2003/03/30 21:49:15 mike Exp $"
*
* Banner routines for the Common UNIX Printing System (CUPS).
*
* See what the filetype is...
*/
- if ((filetype = mimeFileType(MimeDatabase, filename)) == NULL)
+ if ((filetype = mimeFileType(MimeDatabase, filename, NULL)) == NULL)
{
LogMessage(L_WARN, "AddBanner: Banner \"%s\" is of an unknown file type - skipping!",
name);
/*
- * End of "$Id: banners.c,v 1.5.2.4 2003/01/07 18:27:15 mike Exp $".
+ * End of "$Id: banners.c,v 1.5.2.5 2003/03/30 21:49:15 mike Exp $".
*/
/*
- * "$Id: classes.c,v 1.34.2.13 2003/03/30 20:01:42 mike Exp $"
+ * "$Id: classes.c,v 1.34.2.14 2003/03/30 21:49:15 mike Exp $"
*
* Printer class routines for the Common UNIX Printing System (CUPS).
*
*/
fchown(cupsFileNumber(fp), User, Group);
- fchmod(cupsFileNumber(fp), 0600);
+ fchmod(cupsFileNumber(fp), ConfigFilePerm);
/*
* Write a small header to the file...
/*
- * End of "$Id: classes.c,v 1.34.2.13 2003/03/30 20:01:42 mike Exp $".
+ * End of "$Id: classes.c,v 1.34.2.14 2003/03/30 21:49:15 mike Exp $".
*/
/*
- * "$Id: client.c,v 1.91.2.55 2003/03/30 20:01:42 mike Exp $"
+ * "$Id: client.c,v 1.91.2.56 2003/03/30 21:49:15 mike Exp $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
break;
}
- type = mimeFileType(MimeDatabase, filename);
+ type = mimeFileType(MimeDatabase, filename, NULL);
if (IsCGI(con, filename, &filestats, type))
{
break;
}
- type = mimeFileType(MimeDatabase, filename);
+ type = mimeFileType(MimeDatabase, filename, NULL);
if (!IsCGI(con, filename, &filestats, type))
{
* Serve a file...
*/
- type = mimeFileType(MimeDatabase, filename);
+ type = mimeFileType(MimeDatabase, filename, NULL);
if (type == NULL)
strcpy(line, "text/plain");
else
{
confinfo.st_uid = User;
confinfo.st_gid = Group;
- confinfo.st_mode = 0640;
+ confinfo.st_mode = ConfigFilePerm;
}
/*
/*
- * End of "$Id: client.c,v 1.91.2.55 2003/03/30 20:01:42 mike Exp $".
+ * End of "$Id: client.c,v 1.91.2.56 2003/03/30 21:49:15 mike Exp $".
*/
/*
- * "$Id: file.h,v 1.1.2.2 2003/03/30 20:01:44 mike Exp $"
+ * "$Id: file.h,v 1.1.2.3 2003/03/30 21:49:17 mike Exp $"
*
* File definitions for the Common UNIX Printing System (CUPS).
*
# endif /* _cplusplus */
+/*
+ * CUPS file definitions...
+ */
+
+# define CUPS_FILE_NONE 0 /* No compression */
+# define CUPS_FILE_GZIP 1 /* GZIP compression */
+
+
/*
* CUPS file structure...
*/
*/
extern int cupsFileClose(cups_file_t *fp);
-#define cupsFileCompressed(fp) (fp)->compressed
+#define cupsFileCompression(fp) (fp)->compressed
extern int cupsFileFlush(cups_file_t *fp);
extern int cupsFileGetChar(cups_file_t *fp);
extern char *cupsFileGets(cups_file_t *fp, char *buf, int buflen);
#endif /* !_CUPS_FILE_H_ */
/*
- * End of "$Id: file.h,v 1.1.2.2 2003/03/30 20:01:44 mike Exp $".
+ * End of "$Id: file.h,v 1.1.2.3 2003/03/30 21:49:17 mike Exp $".
*/
/*
- * "$Id: ipp.c,v 1.127.2.55 2003/03/30 20:01:44 mike Exp $"
+ * "$Id: ipp.c,v 1.127.2.56 2003/03/30 21:49:17 mike Exp $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
static void accept_jobs(client_t *con, ipp_attribute_t *uri);
static void add_class(client_t *con, ipp_attribute_t *uri);
-static int add_file(client_t *con, job_t *job, mime_type_t *filetype);
+static int add_file(client_t *con, job_t *job, mime_type_t *filetype,
+ int compression);
static void add_job_state_reasons(client_t *con, job_t *job);
static void add_printer(client_t *con, ipp_attribute_t *uri);
static void add_printer_state_reasons(client_t *con, printer_t *p);
static int /* O - 0 on success, -1 on error */
add_file(client_t *con, /* I - Connection to client */
job_t *job, /* I - Job to add to */
- mime_type_t *filetype) /* I - Type of file */
+ mime_type_t *filetype, /* I - Type of file */
+ int compression) /* I - Compression */
{
mime_type_t **filetypes; /* New filetypes array... */
+ int *compressions; /* New compressions array... */
- LogMessage(L_DEBUG2, "add_file(%d, %d, %s/%s)\n", con->http.fd,
- job->id, filetype->super, filetype->type);
+ LogMessage(L_DEBUG2, "add_file(con=%p[%d], job=%d, filetype=%s/%s, compression=%d)\n",
+ con, con->http.fd, job->id, filetype->super, filetype->type,
+ compression);
/*
* Add the file to the job...
*/
if (job->num_files == 0)
- filetypes = (mime_type_t **)malloc(sizeof(mime_type_t *));
+ {
+ compressions = (int *)malloc(sizeof(int));
+ filetypes = (mime_type_t **)malloc(sizeof(mime_type_t *));
+ }
else
- filetypes = (mime_type_t **)realloc(job->filetypes,
- (job->num_files + 1) *
- sizeof(mime_type_t));
+ {
+ compressions = (int *)realloc(job->compressions,
+ (job->num_files + 1) * sizeof(int));
+ filetypes = (mime_type_t **)realloc(job->filetypes,
+ (job->num_files + 1) *
+ sizeof(mime_type_t *));
+ }
- if (filetypes == NULL)
+ if (compressions == NULL || filetypes == NULL)
{
CancelJob(job->id, 1);
LogMessage(L_ERROR, "add_file: unable to allocate memory for file types!");
return (-1);
}
- job->filetypes = filetypes;
- job->filetypes[job->num_files] = filetype;
+ job->compressions = compressions;
+ job->compressions[job->num_files] = compression;
+ job->filetypes = filetypes;
+ job->filetypes[job->num_files] = filetype;
job->num_files ++;
* Open the banner and job files...
*/
- if (add_file(con, job, banner->filetype))
+ if (add_file(con, job, banner->filetype, 0))
return (0);
snprintf(filename, sizeof(filename), "%s/d%05d-%03d", RequestRoot, job->id,
int kbytes; /* Size of file */
int i; /* Looping var */
int lowerpagerange; /* Page range bound */
+ int compression; /* Document compression */
LogMessage(L_DEBUG2, "print_job(%d, %s)\n", con->http.fd,
/*
* OK, see if the client is sending the document compressed - CUPS
- * doesn't support compression yet...
+ * only supports "none" and "gzip".
*/
- if ((attr = ippFindAttribute(con->request, "compression", IPP_TAG_KEYWORD)) != NULL &&
- strcmp(attr->values[0].string.text, "none") == 0)
+ compression = CUPS_FILE_NONE;
+
+ if ((attr = ippFindAttribute(con->request, "compression", IPP_TAG_KEYWORD)) != NULL)
{
- LogMessage(L_ERROR, "print_job: Unsupported compression attribute %s!",
- attr->values[0].string.text);
- send_ipp_error(con, IPP_ATTRIBUTES);
- ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
- "compression", NULL, attr->values[0].string.text);
- return;
+ if (strcmp(attr->values[0].string.text, "none")
+#ifdef HAVE_LIBZ
+ && strcmp(attr->values[0].string.text, "gzip")
+#endif /* HAVE_LIBZ */
+ )
+ {
+ LogMessage(L_ERROR, "print_job: Unsupported compression \"%s\"!",
+ attr->values[0].string.text);
+ send_ipp_error(con, IPP_ATTRIBUTES);
+ ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
+ "compression", NULL, attr->values[0].string.text);
+ return;
+ }
+
+#ifdef HAVE_LIBZ
+ if (!strcmp(attr->values[0].string.text, "gzip"))
+ compression = CUPS_FILE_GZIP;
+#endif /* HAVE_LIBZ */
}
/*
LogMessage(L_DEBUG, "print_job: auto-typing file...");
- filetype = mimeFileType(MimeDatabase, con->filename);
+ filetype = mimeFileType(MimeDatabase, con->filename, &compression);
if (filetype != NULL)
{
* Add the job file...
*/
- if (add_file(con, job, filetype))
+ if (add_file(con, job, filetype, compression))
return;
snprintf(filename, sizeof(filename), "%s/d%05d-%03d", RequestRoot, job->id,
}
-/*
- * PostScript line buffer structure for lines up to 255 chars...
- */
-
-typedef struct
-{
- char buffer[256], /* Line buffer (max 255 chars) */
- *bufptr; /* Pointer to next line */
- int bufused; /* Number of bytes used */
-} cups_psline_t;
-
-
-/*
- * 'read_ps_line()' - Read a line from a PS file...
- */
-
-static char * /* O - Line or NULL on EOF/error */
-read_ps_line(int fd, /* I - File descriptor to read from */
- cups_psline_t *line) /* IO - Line data */
-{
- int bytes; /* Bytes read */
- char *cr, *lf; /* Pointers into buffer */
-
-
- if (line->bufused > 0 && line->bufptr > line->buffer)
- {
- /*
- * Remove the last line that was read from the buffer...
- */
-
- bytes = line->bufptr - line->buffer;
-
- strcpy(line->buffer, line->bufptr);
-
- line->bufused -= bytes;
-
- if (line->bufused < 0)
- line->bufused = 0;
- }
-
- /*
- * Read more data into the buffer...
- */
-
- bytes = sizeof(line->buffer) - line->bufused - 1;
- if ((bytes = read(fd, line->buffer + line->bufused, bytes)) < 0)
- return (NULL);
-
- /*
- * Nul-terminate the string buffer...
- */
-
- line->bufused += bytes;
- line->buffer[line->bufused] = '\0';
-
- /*
- * Check for CR and/or LF.
- */
-
- cr = strchr(line->buffer, '\r');
- lf = strchr(line->buffer, '\n');
-
- if (!cr && !lf)
- return (NULL);
-
- if (cr && cr < lf)
- {
- /*
- * CR and possibly LF terminate this line...
- */
-
- *cr++ = '\0';
- if (*cr == '\n')
- *cr++ = '\0';
-
- line->bufptr = cr;
- }
- else
- {
- /*
- * LF terminates this line...
- */
-
- *lf++ = '\0';
- line->bufptr = lf;
- }
-
- return (line->buffer);
-}
-
-
/*
* 'read_ps_job_ticket()' - Reads a job ticket embedded in a PS file.
*
static void
read_ps_job_ticket(client_t *con) /* I - Client connection */
{
- int fd; /* File to read from */
- cups_psline_t line; /* Line data */
+ cups_file_t *fp; /* File to read from */
+ char line[256]; /* Line data */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
ipp_t *ticket; /* New attributes */
* First open the print file...
*/
- if ((fd = open(con->filename, O_RDONLY)) < 0)
+ if ((fp = cupsFileOpen(con->filename, "rb")) == NULL)
{
LogMessage(L_ERROR, "read_ps_job_ticket: Unable to open PostScript print file - %s",
strerror(errno));
return;
}
- memset(&line, 0, sizeof(line));
-
/*
* Skip the first line...
*/
- if (read_ps_line(fd, &line) == NULL)
+ if (cupsFileGets(fp, line, sizeof(line)) == NULL)
{
LogMessage(L_ERROR, "read_ps_job_ticket: Unable to read from PostScript print file - %s",
strerror(errno));
- close(fd);
+ cupsFileClose(fp);
return;
}
- if (strncmp(line.buffer, "%!PS-Adobe-", 11) != 0)
+ if (strncmp(line, "%!PS-Adobe-", 11) != 0)
{
/*
* Not a DSC-compliant file, so no job ticket info will be available...
*/
- close(fd);
+ cupsFileClose(fp);
return;
}
num_options = 0;
options = NULL;
- while (read_ps_line(fd, &line) != NULL)
+ while (cupsFileGets(fp, line, sizeof(line)) != NULL)
{
/*
* Stop at the first non-ticket line...
*/
- if (strncmp(line.buffer, "%cupsJobTicket:", 15) != 0)
+ if (strncmp(line, "%cupsJobTicket:", 15) != 0)
break;
/*
* Add the options to the option array...
*/
- num_options = cupsParseOptions(line.buffer + 15, num_options, &options);
+ num_options = cupsParseOptions(line + 15, num_options, &options);
}
/*
* Done with the file; see if we have any options...
*/
- close(fd);
+ cupsFileClose(fp);
if (num_options == 0)
return;
printer_t *printer; /* Current printer */
struct stat fileinfo; /* File information */
int kbytes; /* Size of file */
+ int compression; /* Type of compression */
LogMessage(L_DEBUG2, "send_document(%d, %s)\n", con->http.fd,
/*
* OK, see if the client is sending the document compressed - CUPS
- * doesn't support compression yet...
+ * only supports "none" and "gzip".
*/
- if ((attr = ippFindAttribute(con->request, "compression", IPP_TAG_KEYWORD)) != NULL &&
- strcmp(attr->values[0].string.text, "none") == 0)
+ compression = CUPS_FILE_NONE;
+
+ if ((attr = ippFindAttribute(con->request, "compression", IPP_TAG_KEYWORD)) != NULL)
{
- LogMessage(L_ERROR, "send_document: Unsupported compression attribute %s!",
- attr->values[0].string.text);
- send_ipp_error(con, IPP_ATTRIBUTES);
- ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
- "compression", NULL, attr->values[0].string.text);
- return;
+ if (strcmp(attr->values[0].string.text, "none")
+#ifdef HAVE_LIBZ
+ && strcmp(attr->values[0].string.text, "gzip")
+#endif /* HAVE_LIBZ */
+ )
+ {
+ LogMessage(L_ERROR, "print_job: Unsupported compression \"%s\"!",
+ attr->values[0].string.text);
+ send_ipp_error(con, IPP_ATTRIBUTES);
+ ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
+ "compression", NULL, attr->values[0].string.text);
+ return;
+ }
+
+#ifdef HAVE_LIBZ
+ if (!strcmp(attr->values[0].string.text, "gzip"))
+ compression = CUPS_FILE_GZIP;
+#endif /* HAVE_LIBZ */
}
/*
LogMessage(L_DEBUG, "send_document: auto-typing file...");
- filetype = mimeFileType(MimeDatabase, con->filename);
+ filetype = mimeFileType(MimeDatabase, con->filename, &compression);
if (filetype != NULL)
{
* Add the file to the job...
*/
- if (add_file(con, job, filetype))
+ if (add_file(con, job, filetype, compression))
return;
if (job->dtype & CUPS_PRINTER_CLASS)
/*
- * End of "$Id: ipp.c,v 1.127.2.55 2003/03/30 20:01:44 mike Exp $".
+ * End of "$Id: ipp.c,v 1.127.2.56 2003/03/30 21:49:17 mike Exp $".
*/
/*
- * "$Id: job.c,v 1.124.2.58 2003/03/24 21:30:08 mike Exp $"
+ * "$Id: job.c,v 1.124.2.59 2003/03/30 21:49:20 mike Exp $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
#include <grp.h>
+/*
+ * Local globals...
+ */
+
+static mime_filter_t gziptoany_filter =
+ {
+ NULL, /* Source type */
+ NULL, /* Destination type */
+ 0, /* Cost */
+ "gziptoany" /* Filter program to run */
+ };
+
+
/*
* Local functions...
*/
if (current->attrs != NULL)
ippDelete(current->attrs);
- free(current->filetypes);
+ if (current->num_files > 0)
+ {
+ free(current->compressions);
+ free(current->filetypes);
+ }
ClearString(¤t->username);
ClearString(¤t->dest);
next = job->next;
ippDelete(job->attrs);
- free(job->filetypes);
+
+ if (job->num_files > 0)
+ {
+ free(job->compressions);
+ free(job->filetypes);
+ }
+
free(job);
}
printer_t *p; /* Printer or class */
const char *dest; /* Destination */
mime_type_t **filetypes; /* New filetypes array */
+ int *compressions; /* New compressions array */
/*
if (fileid > job->num_files)
{
if (job->num_files == 0)
- filetypes = (mime_type_t **)calloc(sizeof(mime_type_t *), fileid);
+ {
+ compressions = (int *)calloc(fileid, sizeof(int));
+ filetypes = (mime_type_t **)calloc(fileid, sizeof(mime_type_t *));
+ }
else
- filetypes = (mime_type_t **)realloc(job->filetypes,
- sizeof(mime_type_t *) * fileid);
+ {
+ compressions = (int *)realloc(job->compressions,
+ sizeof(int) * fileid);
+ filetypes = (mime_type_t **)realloc(job->filetypes,
+ sizeof(mime_type_t *) * fileid);
+ }
- if (filetypes == NULL)
+ if (compressions == NULL || filetypes == NULL)
{
LogMessage(L_ERROR, "LoadAllJobs: Ran out of memory for job file types!");
continue;
}
- job->filetypes = filetypes;
- job->num_files = fileid;
+ job->compressions = compressions;
+ job->filetypes = filetypes;
+ job->num_files = fileid;
}
- job->filetypes[fileid - 1] = mimeFileType(MimeDatabase, filename);
+ job->filetypes[fileid - 1] = mimeFileType(MimeDatabase, filename,
+ job->compressions + fileid - 1);
if (job->filetypes[fileid - 1] == NULL)
job->filetypes[fileid - 1] = mimeType(MimeDatabase, "application",
FilterLevel += current->cost;
+ /*
+ * Add decompression filters, if any...
+ */
+
+ if (current->compressions[current->current_file])
+ {
+ /*
+ * Add gziptoany filter to the front of the list...
+ */
+
+ mime_filter_t *temp_filters;
+
+ if (num_filters == 0)
+ temp_filters = malloc(sizeof(mime_filter_t));
+ else
+ temp_filters = realloc(filters,
+ sizeof(mime_filter_t) * (num_filters + 1));
+
+ if (temp_filters == NULL)
+ {
+ LogMessage(L_ERROR, "Unable to add decompression filter - %s",
+ strerror(errno));
+
+ free(filters);
+
+ current->current_file ++;
+
+ if (current->current_file == current->num_files)
+ CancelJob(current->id, 0);
+
+ return;
+ }
+
+ filters = temp_filters;
+ filters[num_filters] = gziptoany_filter;
+ num_filters ++;
+ }
+
/*
* Update the printer and job state to "processing"...
*/
/*
- * End of "$Id: job.c,v 1.124.2.58 2003/03/24 21:30:08 mike Exp $".
+ * End of "$Id: job.c,v 1.124.2.59 2003/03/30 21:49:20 mike Exp $".
*/
/*
- * "$Id: job.h,v 1.25.2.9 2003/03/12 21:27:38 mike Exp $"
+ * "$Id: job.h,v 1.25.2.10 2003/03/30 21:49:21 mike Exp $"
*
* Print job definitions for the Common UNIX Printing System (CUPS) scheduler.
*
int num_files; /* Number of files in job */
int current_file; /* Current file in job */
mime_type_t **filetypes; /* File types */
+ int *compressions; /* Compression status of each file */
ipp_t *attrs; /* Job attributes */
int status_pipe; /* Status pipe for this job */
int print_pipes[2], /* Print data pipes */
/*
- * End of "$Id: job.h,v 1.25.2.9 2003/03/12 21:27:38 mike Exp $".
+ * End of "$Id: job.h,v 1.25.2.10 2003/03/30 21:49:21 mike Exp $".
*/
/*
- * "$Id: mime.h,v 1.3.2.6 2003/03/28 22:29:49 mike Exp $"
+ * "$Id: mime.h,v 1.3.2.7 2003/03/30 21:49:22 mike Exp $"
*
* MIME type/conversion database definitions for the Common UNIX Printing System (CUPS).
*
extern mime_type_t *mimeAddType(mime_t *mime, const char *super, const char *type);
extern int mimeAddTypeRule(mime_type_t *mt, const char *rule);
-extern mime_type_t *mimeFileType(mime_t *mime, const char *pathname);
+extern mime_type_t *mimeFileType(mime_t *mime, const char *pathname,
+ int *compression);
extern mime_type_t *mimeType(mime_t *mime, const char *super, const char *type);
extern mime_filter_t *mimeAddFilter(mime_t *mime, mime_type_t *src, mime_type_t *dst,
#endif /* !_CUPS_MIME_H_ */
/*
- * End of "$Id: mime.h,v 1.3.2.6 2003/03/28 22:29:49 mike Exp $".
+ * End of "$Id: mime.h,v 1.3.2.7 2003/03/30 21:49:22 mike Exp $".
*/
/*
- * "$Id: printers.c,v 1.93.2.44 2003/03/30 20:01:48 mike Exp $"
+ * "$Id: printers.c,v 1.93.2.45 2003/03/30 21:49:22 mike Exp $"
*
* Printer routines for the Common UNIX Printing System (CUPS).
*
*/
fchown(cupsFileNumber(fp), User, Group);
- fchmod(cupsFileNumber(fp), 0600);
+ fchmod(cupsFileNumber(fp), ConfigFilePerm);
/*
* Write a small header to the file...
"koi8-r",
"koi8-u",
};
+ const char *compressions[] =
+ {
+#ifdef HAVE_LIBZ
+ "none",
+ "gzip"
+#else
+ "none"
+#endif /* HAVE_LIBZ */
+ };
int num_finishings;
ipp_finish_t finishings[5];
const char *multiple_document_handling[] =
ippAddStrings(CommonData, IPP_TAG_PRINTER,
(ipp_tag_t)(IPP_TAG_MIMETYPE | IPP_TAG_COPY),
"document-format-supported", NumMimeTypes, NULL, MimeTypes);
- ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "compression-supported", NULL, "none");
+ ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "compression-supported",
+ sizeof(compressions) / sizeof(compressions[0]),
+ NULL, compressions);
ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"job-priority-supported", 100);
ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
/*
- * End of "$Id: printers.c,v 1.93.2.44 2003/03/30 20:01:48 mike Exp $".
+ * End of "$Id: printers.c,v 1.93.2.45 2003/03/30 21:49:22 mike Exp $".
*/
/*
- * "$Id: testmime.c,v 1.4.2.3 2003/01/07 18:27:28 mike Exp $"
+ * "$Id: testmime.c,v 1.4.2.4 2003/03/30 21:49:23 mike Exp $"
*
* MIME test program for the Common UNIX Printing System (CUPS).
*
int i; /* Looping var */
char super[MIME_MAX_SUPER], /* Super-type name */
type[MIME_MAX_TYPE]; /* Type name */
+ int compression; /* Compression of file */
mime_t *mime; /* MIME database */
mime_type_t *src, /* Source type */
*dst, /* Destination type */
if (!mime)
mime = mimeLoad("../conf", "../filter");
- src = mimeFileType(mime, argv[i]);
+ src = mimeFileType(mime, argv[i], &compression);
if (src != NULL)
- printf("%s: %s/%s\n", argv[i], src->super, src->type);
+ printf("%s: %s/%s%s\n", argv[i], src->super, src->type,
+ compression ? " (gzipped)" : "");
else
{
printf("%s: unknown\n", argv[i]);
/*
- * End of "$Id: testmime.c,v 1.4.2.3 2003/01/07 18:27:28 mike Exp $".
+ * End of "$Id: testmime.c,v 1.4.2.4 2003/03/30 21:49:23 mike Exp $".
*/
/*
- * "$Id: type.c,v 1.11.2.9 2003/03/28 22:29:49 mike Exp $"
+ * "$Id: type.c,v 1.11.2.10 2003/03/30 21:49:23 mike Exp $"
*
* MIME typing routines for the Common UNIX Printing System (CUPS).
*
mime_type_t * /* O - Type of file */
mimeFileType(mime_t *mime, /* I - MIME database */
- const char *pathname) /* I - Name of file to check */
+ const char *pathname, /* I - Name of file to check */
+ int *compression) /* O - Is the file compressed? */
{
int i; /* Looping var */
cups_file_t *fp; /* File pointer */
* Finally, close the file and return a match (if any)...
*/
+ if (compression)
+ *compression = cupsFileCompression(fp);
+
cupsFileClose(fp);
if (i > 0)
/*
- * End of "$Id: type.c,v 1.11.2.9 2003/03/28 22:29:49 mike Exp $".
+ * End of "$Id: type.c,v 1.11.2.10 2003/03/30 21:49:23 mike Exp $".
*/