]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merged and updated for CUPS 1.1/ESP Print Pro 4.1.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 3 Jan 2000 17:19:49 +0000 (17:19 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 3 Jan 2000 17:19:49 +0000 (17:19 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@836 7a7537e8-13f0-0310-91df-b6672ffda945

cups.list
cups/ipp.c
cups/ipp.h
data/testprint.ps
scheduler/conf.c
scheduler/conf.h
scheduler/ipp.c
scheduler/job.c

index 93848a6ed606bfd3d02a3236126bc064d0e5518a..2da65ff1c27f318fe2cf5e27898c85beb3c749ee 100644 (file)
--- a/cups.list
+++ b/cups.list
@@ -1,5 +1,5 @@
 #
-# "$Id: cups.list,v 1.33 1999/12/15 21:16:02 mike Exp $"
+# "$Id: cups.list,v 1.34 2000/01/03 17:19:45 mike Exp $"
 #
 #   ESP Package Manager (EPM) file list for the Common UNIX Printing
 #   System (CUPS).
@@ -31,7 +31,7 @@
 %vendor Easy Software Products
 %license LICENSE.cups
 %readme README.cups
-%version 1.0.3
+%version 1.1b1
 %incompat printpro
 
 %system all
@@ -315,5 +315,5 @@ f 0444 root sys /usr/man/man5/printers.conf.5 man/printers.conf.5
 i 0555 root sys cups cups.sh
 
 #
-# End of "$Id: cups.list,v 1.33 1999/12/15 21:16:02 mike Exp $".
+# End of "$Id: cups.list,v 1.34 2000/01/03 17:19:45 mike Exp $".
 #
index 5e6f3a32d51a9d3093be40e6b53064e6eaeee1ff..e2da5590719ec6e1ee6cc0869e42fe993751fe35 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c,v 1.28 1999/12/29 02:15:40 mike Exp $"
+ * "$Id: ipp.c,v 1.29 2000/01/03 17:19:46 mike Exp $"
  *
  *   Internet Printing Protocol support functions for the Common UNIX
  *   Printing System (CUPS).
@@ -44,7 +44,7 @@
  *   ippRead()           - Read data for an IPP request.
  *   ippTimeToDate()     - Convert from UNIX time to RFC 1903 format.
  *   ippWrite()          - Write data for an IPP request.
- *   add_attr()          - Add a new attribute to the request.
+ *   _ipp_add_attr()          - Add a new attribute to the request.
  *   ipp_read()          - Semi-blocking read on a HTTP connection...
  */
 
@@ -64,8 +64,7 @@
  * Local functions...
  */
 
-static ipp_attribute_t *add_attr(ipp_t *ipp, int num_values);
-static int             ipp_read(http_t *http, unsigned char *buffer, int length);
+static int     ipp_read(http_t *http, unsigned char *buffer, int length);
 
 
 /*
@@ -86,7 +85,7 @@ ippAddBoolean(ipp_t      *ipp,                /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, 1)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
     return (NULL);
 
   attr->name              = strdup(name);
@@ -119,7 +118,7 @@ ippAddBooleans(ipp_t      *ipp,             /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
     return (NULL);
 
   attr->name      = strdup(name);
@@ -153,7 +152,7 @@ ippAddDate(ipp_t             *ipp,  /* I - IPP request */
   if (ipp == NULL || name == NULL || value == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, 1)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
     return (NULL);
 
   attr->name      = strdup(name);
@@ -185,7 +184,7 @@ ippAddInteger(ipp_t      *ipp,              /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, 1)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
     return (NULL);
 
   attr->name              = strdup(name);
@@ -216,7 +215,7 @@ ippAddIntegers(ipp_t      *ipp,             /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
     return (NULL);
 
   attr->name      = strdup(name);
@@ -249,7 +248,7 @@ ippAddString(ipp_t      *ipp,               /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, 1)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
     return (NULL);
 
   attr->name                      = strdup(name);
@@ -282,7 +281,7 @@ ippAddStrings(ipp_t      *ipp,              /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
     return (NULL);
 
   attr->name      = strdup(name);
@@ -321,7 +320,7 @@ ippAddRange(ipp_t      *ipp,                /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, 1)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
     return (NULL);
 
   attr->name                  = strdup(name);
@@ -353,7 +352,7 @@ ippAddRanges(ipp_t      *ipp,               /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
     return (NULL);
 
   attr->name                  = strdup(name);
@@ -389,7 +388,7 @@ ippAddResolution(ipp_t      *ipp,   /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, 1)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
     return (NULL);
 
   attr->name                       = strdup(name);
@@ -423,7 +422,7 @@ ippAddResolutions(ipp_t      *ipp,  /* I - IPP request */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
     return (NULL);
 
   attr->name                       = strdup(name);
@@ -457,7 +456,7 @@ ippAddSeparator(ipp_t *ipp)         /* I - IPP request */
   if (ipp == NULL)
     return (NULL);
 
-  if ((attr = add_attr(ipp, 0)) == NULL)
+  if ((attr = _ipp_add_attr(ipp, 0)) == NULL)
     return (NULL);
 
   attr->group_tag = IPP_TAG_ZERO;
@@ -861,7 +860,7 @@ ippRead(http_t *http,               /* I - HTTP data */
            buffer[n] = '\0';
            DEBUG_printf(("ippRead: name = \'%s\'\n", buffer));
 
-           attr = ipp->current = add_attr(ipp, IPP_MAX_VALUES);
+           attr = ipp->current = _ipp_add_attr(ipp, IPP_MAX_VALUES);
 
            attr->group_tag  = ipp->curtag;
            attr->value_tag  = tag;
@@ -1206,7 +1205,7 @@ ippWrite(http_t *http,            /* I - HTTP data */
                   DEBUG_printf(("ippWrite: writing string = %d, \'%s\'\n", n,
                                attr->values[i].string.text));
 
-                  if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2)
+                  if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2))
                  {
                     if (httpWrite(http, (char *)buffer, bufptr - buffer) < 0)
                    {
@@ -1321,7 +1320,7 @@ ippWrite(http_t *http,            /* I - HTTP data */
 
                   n = strlen(attr->values[i].string.charset);
 
-                  if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2)
+                  if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2))
                  {
                     if (httpWrite(http, (char *)buffer, bufptr - buffer) < 0)
                    {
@@ -1339,7 +1338,7 @@ ippWrite(http_t *http,            /* I - HTTP data */
 
                   n = strlen(attr->values[i].string.text);
 
-                  if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2)
+                  if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2))
                  {
                     if (httpWrite(http, (char *)buffer, bufptr - buffer) < 0)
                    {
@@ -1424,17 +1423,17 @@ ippPort(void)
 
 
 /*
- * 'add_attr()' - Add a new attribute to the request.
+ * '_ipp_add_attr()' - Add a new attribute to the request.
  */
 
-static ipp_attribute_t *               /* O - New attribute */
-add_attr(ipp_t *ipp,                   /* I - IPP request */
-         int   num_values)             /* I - Number of values */
+ipp_attribute_t *              /* O - New attribute */
+_ipp_add_attr(ipp_t *ipp,      /* I - IPP request */
+              int   num_values)        /* I - Number of values */
 {
-  ipp_attribute_t      *attr;          /* New attribute */
+  ipp_attribute_t      *attr;  /* New attribute */
 
 
-  DEBUG_printf(("add_attr(%08x, %d)\n", ipp, num_values));
+  DEBUG_printf(("_ipp_add_attr(%08x, %d)\n", ipp, num_values));
 
   if (ipp == NULL || num_values < 0)
     return (NULL);
@@ -1488,5 +1487,5 @@ ipp_read(http_t        *http,     /* I - Client connection */
 
 
 /*
- * End of "$Id: ipp.c,v 1.28 1999/12/29 02:15:40 mike Exp $".
+ * End of "$Id: ipp.c,v 1.29 2000/01/03 17:19:46 mike Exp $".
  */
index b182851f1f817fb898dd3fa5c5f1d67da4f190ba..b7a7cea6c9fcd6daae65843756817cda89987ce9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.h,v 1.20 1999/12/29 02:15:40 mike Exp $"
+ * "$Id: ipp.h,v 1.21 2000/01/03 17:19:46 mike Exp $"
  *
  *   Internet Printing Protocol definitions for the Common UNIX Printing
  *   System (CUPS).
@@ -144,7 +144,7 @@ typedef enum                        /**** Job States.... */
   IPP_JOB_HELD,
   IPP_JOB_PROCESSING,
   IPP_JOB_STOPPED,
-  IPP_JOB_CANCELED,
+  IPP_JOB_CANCELLED,
   IPP_JOB_ABORTED,
   IPP_JOB_COMPLETED
 } ipp_jstate_t;
@@ -194,6 +194,7 @@ typedef enum                        /**** IPP operations... ****/
   CUPS_ACCEPT_JOBS,
   CUPS_REJECT_JOBS,
   CUPS_SET_DEFAULT,
+  CUPS_GET_BANNERS,
   CUPS_GET_DEVICES,
   CUPS_GET_PPDS
 } ipp_op_t;
@@ -331,6 +332,9 @@ extern const ipp_uchar_t *ippTimeToDate(time_t t);
 extern ipp_state_t     ippWrite(http_t *http, ipp_t *ipp);
 extern int             ippPort(void);
 
+extern ipp_attribute_t *_ipp_add_attr(ipp_t *, int);
+
+
 /*
  * C++ magic...
  */
@@ -341,5 +345,5 @@ extern int          ippPort(void);
 #endif /* !_CUPS_IPP_H_ */
 
 /*
- * End of "$Id: ipp.h,v 1.20 1999/12/29 02:15:40 mike Exp $".
+ * End of "$Id: ipp.h,v 1.21 2000/01/03 17:19:46 mike Exp $".
  */
index 150c3ed2bf748179aba78f9aaa5575c4a8dc83cf..d06bb7d237f1e115cb19a0ad4ff31acd08005bdc 100644 (file)
@@ -465,7 +465,7 @@ gsave
   pageWidth 36 mul                     % Center of page
   pageWidth 19 mul                     % Bottom of page
   2 copy moveto                                % Position text
-  (Printed Using ESP Print Pro v4.0.1) CENTER  % Show text centered
+  (Printed Using ESP Print Pro v4.0.3) CENTER  % Show text centered
 
   pageWidth 3 mul sub                  % Move down...
   2 copy moveto                                % Position text
@@ -507,6 +507,6 @@ gsave
 grestore
 showpage
 %
-% End of "$Id: testprint.ps,v 1.5 1999/11/05 15:06:02 mike Exp $".
+% End of "$Id: testprint.ps,v 1.6 2000/01/03 17:19:46 mike Exp $".
 %
 %%EOF
index 44c1a3e6fde6aaf6b3f34939fc05e0a938e6395e..2032523ff78dd9fd989b34f10cbc5c5c225396a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: conf.c,v 1.36 1999/12/29 02:15:41 mike Exp $"
+ * "$Id: conf.c,v 1.37 2000/01/03 17:19:49 mike Exp $"
  *
  *   Configuration routines for the Common UNIX Printing System (CUPS).
  *
@@ -178,9 +178,10 @@ ReadConfiguration(void)
   strcpy(ServerRoot, CUPS_SERVERROOT);
   strcpy(ServerBin, CUPS_SERVERBIN);
   strcpy(RequestRoot, CUPS_REQUESTS);
-  strcpy(DocumentRoot, CUPS_DOCDIR);
-  strcpy(AccessLog, "logs/access_log");
-  strcpy(ErrorLog, "logs/error_log");
+  strcpy(DocumentRoot, CUPS_DOCROOT);
+  strcpy(AccessLog, CUPS_LOGDIR "/access_log");
+  strcpy(ErrorLog, CUPS_LOGDIR "/error_log");
+  strcpy(PageLog, CUPS_LOGDIR "/page_log");
 
   if ((language = DEFAULT_LANGUAGE) == NULL)
     language = "en";
@@ -374,7 +375,6 @@ ReadConfiguration(void)
   * Check for queued jobs...
   */
 
-  LoadJobs();
   CheckJobs();
 
   return (1);
@@ -972,5 +972,5 @@ get_address(char               *value,              /* I - Value string */
 
 
 /*
- * End of "$Id: conf.c,v 1.36 1999/12/29 02:15:41 mike Exp $".
+ * End of "$Id: conf.c,v 1.37 2000/01/03 17:19:49 mike Exp $".
  */
index 5e2513dbe9f1f1e41316e947b1820a35f6ef08e5..aa6b8eaa8e1fef67ee2893918da836de2795f530 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: conf.h,v 1.17 1999/12/29 02:15:41 mike Exp $"
+ * "$Id: conf.h,v 1.18 2000/01/03 17:19:49 mike Exp $"
  *
  *   Configuration file definitions for the Common UNIX Printing System (CUPS)
  *   scheduler.
@@ -39,7 +39,7 @@
  * Globals...
  */
 
-VAR char               ConfigurationFile[256]  VALUE(CUPS_SERVERROOT "/conf/cupsd.conf"),
+VAR char               ConfigurationFile[256]  VALUE(CUPS_SERVERROOT "/cupsd.conf"),
                                        /* Configuration file to use */
                        ServerName[256]         VALUE(""),
                                        /* FQDN for server */
@@ -51,15 +51,15 @@ VAR char            ConfigurationFile[256]  VALUE(CUPS_SERVERROOT "/conf/cupsd.conf"),
                                        /* Root directory for binaries */
                        RequestRoot[1024]       VALUE(CUPS_REQUESTS),
                                        /* Directory for request files */
-                       DocumentRoot[1024]      VALUE(CUPS_DATADIR "/doc"),
+                       DocumentRoot[1024]      VALUE(CUPS_DOCROOT),
                                        /* Root directory for documents */
                        SystemGroup[32],
                                        /* System group name */
-                       AccessLog[1024]         VALUE("logs/access_log"),
+                       AccessLog[1024]         VALUE(CUPS_LOGDIR "/access_log"),
                                        /* Access log filename */
-                       ErrorLog[1024]          VALUE("logs/error_log"),
+                       ErrorLog[1024]          VALUE(CUPS_LOGDIR "/error_log"),
                                        /* Error log filename */
-                       PageLog[1024]           VALUE("logs/page_log"),
+                       PageLog[1024]           VALUE(CUPS_LOGDIR "/page_log"),
                                        /* Page log filename */
                        DefaultLanguage[32]     VALUE("C"),
                                        /* Default language encoding */
@@ -112,5 +112,5 @@ extern int  LogPage(job_t *job, char *page);
 
 
 /*
- * End of "$Id: conf.h,v 1.17 1999/12/29 02:15:41 mike Exp $".
+ * End of "$Id: conf.h,v 1.18 2000/01/03 17:19:49 mike Exp $".
  */
index f1fa392afdecedf667eed7fbef8ffd7a634d53a7..46214c877c4afda7f02b53000fda26f6e72053df 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c,v 1.38 1999/12/29 02:15:41 mike Exp $"
+ * "$Id: ipp.c,v 1.39 2000/01/03 17:19:49 mike Exp $"
  *
  *   IPP routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -1568,6 +1568,7 @@ static void
 get_jobs(client_t        *con,         /* I - Client connection */
         ipp_attribute_t *uri)          /* I - Printer URI */
 {
+  int                  i;              /* Looping var */
   ipp_attribute_t      *attr;          /* Current attribute */
   char                 *dest;          /* Destination */
   cups_ptype_t         dtype;          /* Destination type (printer or class) */
@@ -1588,7 +1589,9 @@ get_jobs(client_t        *con,            /* I - Client connection */
                                        /* Job URI... */
                        printer_uri[HTTP_MAX_URI];
                                        /* Printer URI... */
+  char                 filename[1024]; /* Job filename */
   struct stat          filestats;      /* Print file information */
+  size_t               jobsize;        /* Total job sizes */
 
 
   DEBUG_printf(("get_jobs(%08x, %08x)\n", con, uri));
@@ -1725,9 +1728,15 @@ get_jobs(client_t        *con,           /* I - Client connection */
     ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_NAME, "job-name",
                   NULL, job->title);
 
-    stat(job->filename, &filestats);
+    for (i = 0, jobsize = 0; i < job->num_files; i ++)
+    {
+      sprintf(filename, "%s/d%05d-%03d", RequestRoot, job->id, i + 1);
+      stat(filename, &filestats);
+      jobsize += filestats.st_size;
+    }
+
     ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER,
-                  "job-k-octets", (filestats.st_size + 1023) / 1024);
+                  "job-k-octets", (jobsize + 1023) / 1024);
 
     ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI,
                  "job-more-info", NULL, job_uri);
@@ -1762,6 +1771,7 @@ static void
 get_job_attrs(client_t        *con,            /* I - Client connection */
              ipp_attribute_t *uri)             /* I - Job URI */
 {
+  int                  i;              /* Looping var */
   ipp_attribute_t      *attr;          /* Current attribute */
   int                  jobid;          /* Job ID */
   job_t                        *job;           /* Current job */
@@ -1778,7 +1788,9 @@ get_job_attrs(client_t        *con,               /* I - Client connection */
                                        /* Job URI... */
                        printer_uri[HTTP_MAX_URI];
                                        /* Printer URI... */
+  char                 filename[1024]; /* Job filename */
   struct stat          filestats;      /* Print file information */
+  size_t               jobsize;        /* Total job sizes */
 
 
   DEBUG_printf(("get_job_attrs(%08x, %08x)\n", con, uri));
@@ -1857,11 +1869,17 @@ get_job_attrs(client_t        *con,             /* I - Client connection */
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id);
 
   ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_NAME, "job-name",
-                NULL, job->title);
+               NULL, job->title);
+
+  for (i = 0, jobsize = 0; i < job->num_files; i ++)
+  {
+    sprintf(filename, "%s/d%05d-%03d", RequestRoot, job->id, i + 1);
+    stat(filename, &filestats);
+    jobsize += filestats.st_size;
+  }
 
-  stat(job->filename, &filestats);
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER,
-                "job-k-octets", (filestats.st_size + 1023) / 1024);
+                "job-k-octets", (jobsize + 1023) / 1024);
 
   ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI,
                "job-more-info", NULL, job_uri);
@@ -2430,7 +2448,7 @@ print_job(client_t        *con,           /* I - Client connection */
   job->attrs    = con->request;
   con->request  = NULL;
 
-  if ((filetypes = (mimetype_t **)malloc(sizeof(mimetype_t *))) == NULL)
+  if ((job->filetypes = (mime_type_t **)malloc(sizeof(mime_type_t *))) == NULL)
   {
     CancelJob(job->id);
     LogMessage(LOG_ERROR, "print_job: unable to allocate memory for file types!");
@@ -2438,10 +2456,9 @@ print_job(client_t        *con,          /* I - Client connection */
     return;
   }
 
-  job->filetypes = filetypes;
-  job->filetypes[job->num_files] = filetype;
+  job->filetypes[0] = filetype;
+  job->num_files    = 1;
 
-  job->num_files ++;
   sprintf(filename, "%s/d%05d-%03d", RequestRoot, job->id, job->num_files);
   rename(con->filename, filename);
 
@@ -2743,12 +2760,9 @@ static void
 send_document(client_t        *con,    /* I - Client connection */
              ipp_attribute_t *uri)     /* I - Printer URI */
 {
+  int                  i;              /* Looping var */
   ipp_attribute_t      *attr;          /* Current attribute */
   ipp_attribute_t      *format;        /* Document-format attribute */
-  char                 *dest;          /* Destination */
-  cups_ptype_t         dtype;          /* Destination type (printer or class) */
-  int                  priority;       /* Job priority */
-  char                 *title;         /* Job name/title */
   int                  jobid;          /* Job ID number */
   job_t                        *job;           /* Current job */
   char                 job_uri[HTTP_MAX_URI],
@@ -2771,6 +2785,9 @@ send_document(client_t        *con,       /* I - Client connection */
                        mimetype[MIME_MAX_SUPER + MIME_MAX_TYPE + 2];
                                        /* Textual name of mime type */
   printer_t            *printer;       /* Printer data */
+  struct passwd                *user;          /* User info */
+  struct group         *group;         /* System group info */
+  char                 filename[1024]; /* Job filename */
 
 
   DEBUG_printf(("send_document(%08x, %08x)\n", con, uri));
@@ -2996,11 +3013,11 @@ send_document(client_t        *con,     /* I - Client connection */
   */
 
   if (job->num_files == 0)
-    filetypes = (mimetype_t **)malloc(sizeof(mimetype_t *));
+    filetypes = (mime_type_t **)malloc(sizeof(mime_type_t *));
   else
-    filetypes = (mimetype_t **)realloc(job->filetypes,
+    filetypes = (mime_type_t **)realloc(job->filetypes,
                                        (job->num_files + 1) *
-                                      sizeof(mimetype_t));
+                                      sizeof(mime_type_t));
 
   if (filetypes == NULL)
   {
@@ -3017,8 +3034,6 @@ send_document(client_t        *con,       /* I - Client connection */
   sprintf(filename, "%s/d%05d-%03d", RequestRoot, job->id, job->num_files);
   rename(con->filename, filename);
 
-  strncpy(job->title, title, sizeof(job->title) - 1);
-
   con->filename[0] = '\0';
 
   LogMessage(LOG_INFO, "File queued in job #%d by \'%s\'.", job->id,
@@ -3419,7 +3434,7 @@ validate_job(client_t        *con,        /* I - Client connection */
 
   if ((format = ippFindAttribute(con->request, "document-format", IPP_TAG_MIMETYPE)) == NULL)
   {
-    LogError(LOG_ERROR, "validate_job: missing document-format attribute!");
+    LogMessage(LOG_ERROR, "validate_job: missing document-format attribute!");
     send_ipp_error(con, IPP_BAD_REQUEST);
     return;
   }
@@ -3470,5 +3485,5 @@ validate_job(client_t        *con,        /* I - Client connection */
 
 
 /*
- * End of "$Id: ipp.c,v 1.38 1999/12/29 02:15:41 mike Exp $".
+ * End of "$Id: ipp.c,v 1.39 2000/01/03 17:19:49 mike Exp $".
  */
index 23ad091e56672199f09638aabcd19f92e6cb3d4a..a740ad26de440430c60f35c31b7536ada9ef1b04 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: job.c,v 1.44 1999/12/29 02:15:42 mike Exp $"
+ * "$Id: job.c,v 1.45 2000/01/03 17:19:49 mike Exp $"
  *
  *   Job management routines for the Common UNIX Printing System (CUPS).
  *
  * Local functions...
  */
 
-static ipp_state_t     ipp_read_file(const char *filename, ipp_t *request);
-static ipp_state_t     ipp_write_file(const char *filename, ipp_t *request);
-static int             start_process(const char *command, const char *argv[],
-                                     const char *envp[], int in, int out, int err);
+static ipp_state_t     ipp_read_file(const char *filename, ipp_t *ipp);
+static ipp_state_t     ipp_write_file(const char *filename, ipp_t *ipp);
+static int             start_process(const char *command, char *argv[],
+                                     char *envp[], int in, int out, int err);
 
 
 /*
@@ -132,6 +132,8 @@ CancelJob(int id)           /* I - Job to cancel */
       * files...
       */
 
+      current->current_file = 0;
+
       if (!JobHistory || !JobFiles)
         for (i = 1; i <= current->num_files; i ++)
        {
@@ -408,6 +410,7 @@ StartJob(int       id,              /* I - Job ID */
   int          statusfds[2],   /* Pipes used between the filters and scheduler */
                filterfds[2][2];/* Pipes used between the filters */
   char         *argv[8],       /* Filter command-line arguments */
+               filename[1024], /* Job filename */
                command[1024],  /* Full path to filter/backend command */
                jobid[255],     /* Job ID string */
                title[IPP_MAX_NAME],
@@ -484,7 +487,7 @@ StartJob(int       id,              /* I - Job ID */
     * Local jobs get filtered...
     */
 
-    filters = mimeFilter(MimeDatabase, current->filetype,
+    filters = mimeFilter(MimeDatabase, current->filetypes[current->current_file],
                          printer->filetype, &num_filters);
 
     if (num_filters == 0)
@@ -610,7 +613,11 @@ StartJob(int       id,             /* I - Job ID */
   * printing interface to be used by CUPS.
   */
 
+  current->current_file ++;
+
   sprintf(jobid, "%d", current->id);
+  sprintf(filename, "%s/d%05d-%03d", RequestRoot, current->id,
+          current->current_file);
 
   argv[0] = printer->name;
   argv[1] = jobid;
@@ -618,7 +625,7 @@ StartJob(int       id,              /* I - Job ID */
   argv[3] = title;
   argv[4] = copies;
   argv[5] = options;
-  argv[6] = current->filename;
+  argv[6] = filename;
   argv[7] = NULL;
 
   DEBUG_printf(("StartJob: args = \'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\'\n",
@@ -643,8 +650,9 @@ StartJob(int       id,              /* I - Job ID */
     sprintf(charset, "CHARSET=%s", attr->values[0].string.text);
   }
 
-  sprintf(content_type, "CONTENT_TYPE=%s/%s", current->filetype->super,
-          current->filetype->type);
+  sprintf(content_type, "CONTENT_TYPE=%s/%s",
+          current->filetypes[current->current_file]->super,
+          current->filetypes[current->current_file]->type);
   sprintf(device_uri, "DEVICE_URI=%s", printer->device_uri);
   sprintf(ppd, "PPD=%s/ppd/%s.ppd", ServerRoot, printer->name);
   sprintf(printer_name, "PRINTER=%s", printer->name);
@@ -742,7 +750,7 @@ StartJob(int       id,              /* I - Job ID */
                  filterfds[i & 1][1]));
 
     pid = start_process(command, argv, envp, filterfds[!(i & 1)][0],
-                       filterfds[i & 1][1], statusfds[1]);
+                        filterfds[i & 1][1], statusfds[1]);
 
     close(filterfds[!(i & 1)][0]);
     close(filterfds[!(i & 1)][1]);
@@ -791,7 +799,7 @@ StartJob(int       id,              /* I - Job ID */
                  filterfds[i & 1][1]));
 
     pid = start_process(command, argv, envp, filterfds[!(i & 1)][0],
-                       filterfds[i & 1][1], statusfds[1]);
+                       filterfds[i & 1][1], statusfds[1]);
 
     close(filterfds[!(i & 1)][0]);
     close(filterfds[!(i & 1)][1]);
@@ -863,11 +871,13 @@ StopJob(int id)                   /* I - Job ID */
       {
         DEBUG_puts("StopJob: job state is \'processing\'.");
 
-        if (current->status)
+        if (current->status > 0)
          SetPrinterState(current->printer, IPP_PRINTER_STOPPED);
-       else if (current->printer->state == IPP_PRINTER_BUSY)
+       else
          SetPrinterState(current->printer, IPP_PRINTER_IDLE);
 
+        DEBUG_printf(("StopJob: printer state is %d\n", current->printer->state));
+
        current->state        = IPP_JOB_STOPPED;
         current->printer->job = NULL;
         current->printer      = NULL;
@@ -1008,6 +1018,7 @@ UpdateJob(job_t *job)             /* I - Job to check */
 
       StopJob(job->id);
       job->state = IPP_JOB_PENDING;
+      job->current_file --;
     }
     else if (job->status > 0)
     {
@@ -1015,12 +1026,17 @@ UpdateJob(job_t *job)           /* I - Job to check */
       * Filter had errors; cancel it...
       */
 
-      CancelJob(job->id);
+      if (job->current_file < job->num_files)
+        StartJob(job->id, job->printer);
+      else
+      {
+        CancelJob(job->id);
 
-      if (JobHistory)
-        job->state = IPP_JOB_ABORTED;
+        if (JobHistory)
+          job->state = IPP_JOB_ABORTED;
 
-      CheckJobs();
+        CheckJobs();
+      }
     }
     else
     {
@@ -1028,14 +1044,17 @@ UpdateJob(job_t *job)           /* I - Job to check */
       * Job printed successfully; cancel it...
       */
 
-      job->printer->state_message[0] = '\0';
-
-      CancelJob(job->id);
+      if (job->current_file < job->num_files)
+        StartJob(job->id, job->printer);
+      else
+      {
+       CancelJob(job->id);
 
-      if (JobHistory)
-        job->state = IPP_JOB_COMPLETED;
+       if (JobHistory)
+          job->state = IPP_JOB_COMPLETED;
 
-      CheckJobs();
+       CheckJobs();
+      }
     }
   }
 }
@@ -1047,7 +1066,7 @@ UpdateJob(job_t *job)             /* I - Job to check */
 
 static ipp_state_t                     /* O - State */
 ipp_read_file(const char *filename,    /* I - File to read from */
-              ipp_t      *request)     /* I - Request to read into */
+              ipp_t      *ipp)         /* I - Request to read into */
 {
   int                  fd;             /* File descriptor for file */
   int                  n;              /* Length of data */
@@ -1060,7 +1079,7 @@ ipp_read_file(const char *filename,       /* I - File to read from */
   * Open the file if possible...
   */
 
-  if (filename == NULL || request == NULL)
+  if (filename == NULL || ipp == NULL)
     return (IPP_ERROR);
 
   if ((fd = open(filename, O_RDONLY)) == -1)
@@ -1203,7 +1222,7 @@ ipp_read_file(const char *filename,       /* I - File to read from */
            buffer[n] = '\0';
            DEBUG_printf(("ippRead: name = \'%s\'\n", buffer));
 
-           attr = ipp->current = add_attr(ipp, IPP_MAX_VALUES);
+           attr = ipp->current = _ipp_add_attr(ipp, IPP_MAX_VALUES);
 
            attr->group_tag  = ipp->curtag;
            attr->value_tag  = tag;
@@ -1360,7 +1379,7 @@ ipp_read_file(const char *filename,       /* I - File to read from */
 
 static ipp_state_t                     /* O - State */
 ipp_write_file(const char *filename,   /* I - File to write to */
-               ipp_t      *request)    /* I - Request to write */
+               ipp_t      *ipp)                /* I - Request to write */
 {
   int                  fd;             /* File descriptor */
   int                  i;              /* Looping var */
@@ -1374,10 +1393,10 @@ ipp_write_file(const char *filename,    /* I - File to write to */
   * Open the file if possible...
   */
 
-  if (filename == NULL || request == NULL)
+  if (filename == NULL || ipp == NULL)
     return (IPP_ERROR);
 
-  if ((fd = open(filename, O_WRONLY | O_CREATE | O_TRUNC, 0640)) == -1)
+  if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0640)) == -1)
     return (IPP_ERROR);
 
   fchmod(fd, 0640);
@@ -1746,8 +1765,8 @@ ipp_write_file(const char *filename,      /* I - File to write to */
 
 static int                             /* O - Process ID or 0 */
 start_process(const char *command,     /* I - Full path to command */
-              const char *argv[],      /* I - Command-line arguments */
-             const char *envp[],       /* I - Environment */
+              char       *argv[],      /* I - Command-line arguments */
+             char       *envp[],       /* I - Environment */
               int        infd,         /* I - Standard input file descriptor */
              int        outfd,         /* I - Standard output file descriptor */
              int        errfd)         /* I - Standard error file descriptor */
@@ -1819,5 +1838,5 @@ start_process(const char *command,        /* I - Full path to command */
 
 
 /*
- * End of "$Id: job.c,v 1.44 1999/12/29 02:15:42 mike Exp $".
+ * End of "$Id: job.c,v 1.45 2000/01/03 17:19:49 mike Exp $".
  */