]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The LPD backend used the full length of the hostname
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 6 Feb 2004 21:01:51 +0000 (21:01 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 6 Feb 2004 21:01:51 +0000 (21:01 +0000)
when creating the data and control filenames, which
causes problems with older systems that can't handle
long filenames (STR #560)

Debug support for pdftops.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@4050 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
backend/lpd.c
pdftops/Gfx.cxx
pdftops/PDFDoc.cxx
pdftops/Page.cxx
pdftops/pdftops.cxx

index 74db3cba37d38e34c0d5ba26e2e0dcba932ea36d..4f27ebe97fcf67c56a17cc0588dab8f13974953f 100644 (file)
@@ -1,8 +1,12 @@
-CHANGES.txt - 02/05/2004
+CHANGES.txt - 02/06/2004
 ------------------------
 
 CHANGES IN CUPS V1.1.21rc1
 
+       - The LPD backend used the full length of the hostname
+         when creating the data and control filenames, which
+         causes problems with older systems that can't handle
+         long filenames (STR #560)
        - The scheduler did not refresh the common printer data
          after a fast reload; this prevented banner and other
          information from being updated (STR #562)
index 94541b8724c010bb31f1bdb6751beae63764ce21..e328386918dc6133af06e9995931caf23826beca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpd.c,v 1.56 2003/11/19 18:58:04 mike Exp $"
+ * "$Id: lpd.c,v 1.57 2004/02/06 21:01:51 mike Exp $"
  *
  *   Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
  *
@@ -233,6 +233,14 @@ main(int  argc,                            /* I - Number of command-line arguments (6 or 7) */
   timeout        = 300;
   sanitize_title = 1;
 
+#if defined(__APPLE__)
+  /* We want to use a reserved port if possible (3471949) */
+  reserve        = 1;
+
+  /* We want to pass utf-8 characters, not re-map them (3071945) */
+  sanitize_title= 0;
+#endif
+
   if ((options = strchr(resource, '?')) != NULL)
   {
    /*
@@ -668,21 +676,21 @@ lpd_queue(const char *hostname,           /* I - Host to connect to */
 
     while (copies > 0)
     {
-      snprintf(cptr, sizeof(control) - (cptr - control), "%cdfA%03d%s\n", format,
+      snprintf(cptr, sizeof(control) - (cptr - control), "%cdfA%03d%.15s\n", format,
                getpid() % 1000, localhost);
       cptr   += strlen(cptr);
       copies --;
     }
 
     snprintf(cptr, sizeof(control) - (cptr - control),
-             "UdfA%03d%s\nN%s\n",
+             "UdfA%03d%.15s\nN%s\n",
              getpid() % 1000, localhost, title);
 
     fprintf(stderr, "DEBUG: Control file is:\n%s", control);
 
     if (order == ORDER_CONTROL_DATA)
     {
-      if (lpd_command(fd, timeout, "\002%d cfA%03.3d%s\n", strlen(control),
+      if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
                       getpid() % 1000, localhost))
         return (1);
 
@@ -723,7 +731,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
       * Send the print file...
       */
 
-      if (lpd_command(fd, timeout, "\003%u dfA%03.3d%s\n",
+      if (lpd_command(fd, timeout, "\003%u dfA%03.3d%.15s\n",
                       (unsigned)filestats.st_size, getpid() % 1000,
                      localhost))
         return (1);
@@ -788,7 +796,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
 
     if (status == 0 && order == ORDER_DATA_CONTROL)
     {
-      if (lpd_command(fd, timeout, "\002%d cfA%03.3d%s\n", strlen(control),
+      if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
                       getpid() % 1000, localhost))
         return (1);
 
@@ -994,5 +1002,5 @@ sigterm_handler(int sig)           /* I - Signal */
 
 
 /*
- * End of "$Id: lpd.c,v 1.56 2003/11/19 18:58:04 mike Exp $".
+ * End of "$Id: lpd.c,v 1.57 2004/02/06 21:01:51 mike Exp $".
  */
index 95f10a927c1fec8e98075312b0ebb6991090da95..ec6b2e4a77b73d741a909068d33b3b7b7409f893 100644 (file)
@@ -540,13 +540,14 @@ void Gfx::go(GBool topLevel) {
     // got a command - execute it
     if (obj.isCmd()) {
       if (printCommands) {
-       obj.print(stdout);
+        fputs("DEBUG2: ", stderr);
+       obj.print(stderr);
        for (i = 0; i < numArgs; ++i) {
-         printf(" ");
-         args[i].print(stdout);
+         putc(' ', stderr);
+         args[i].print(stderr);
        }
-       printf("\n");
-       fflush(stdout);
+       putc('\n', stderr);
+       fflush(stderr);
       }
       execOp(&obj, args, numArgs);
       obj.free();
@@ -578,10 +579,10 @@ void Gfx::go(GBool topLevel) {
     } else {
       error(getPos(), "Too many args in content stream");
       if (printCommands) {
-       printf("throwing away arg: ");
-       obj.print(stdout);
-       printf("\n");
-       fflush(stdout);
+       fputs("DEBUG2: throwing away arg: ", stderr);
+       obj.print(stderr);
+       putc('\n', stderr);
+       fflush(stderr);
       }
       obj.free();
     }
@@ -595,13 +596,13 @@ void Gfx::go(GBool topLevel) {
   if (numArgs > 0) {
     error(getPos(), "Leftover args in content stream");
     if (printCommands) {
-      printf("%d leftovers:", numArgs);
+      fprintf(stderr, "DEBUG2: %d leftovers:", numArgs);
       for (i = 0; i < numArgs; ++i) {
-       printf(" ");
-       args[i].print(stdout);
+       putc(' ', stderr);
+       args[i].print(stderr);
       }
-      printf("\n");
-      fflush(stdout);
+      putc('\n', stderr);
+      fflush(stderr);
     }
     for (i = 0; i < numArgs; ++i)
       args[i].free();
@@ -2139,11 +2140,11 @@ void Gfx::opSetFont(Object args[], int numArgs) {
     return;
   }
   if (printCommands) {
-    printf("  font: tag=%s name='%s' %g\n",
-          font->getTag()->getCString(),
-          font->getName() ? font->getName()->getCString() : "???",
-          args[1].getNum());
-    fflush(stdout);
+    fprintf(stderr, "DEBUG2:   font: tag=%s name='%s' %g\n",
+           font->getTag()->getCString(),
+           font->getName() ? font->getName()->getCString() : "???",
+           args[1].getNum());
+    fflush(stderr);
   }
   state->setFont(font, args[1].getNum());
   fontChanged = gTrue;
@@ -3032,11 +3033,11 @@ void Gfx::opEndIgnoreUndef(Object args[], int numArgs) {
 
 void Gfx::opBeginMarkedContent(Object args[], int numArgs) {
   if (printCommands) {
-    printf("  marked content: %s ", args[0].getName());
+    fprintf(stderr, "DEBUG2:   marked content: %s ", args[0].getName());
     if (numArgs == 2)
-      args[2].print(stdout);
-    printf("\n");
-    fflush(stdout);
+      args[2].print(stderr);
+    putc('\n', stderr);
+    fflush(stderr);
   }
 }
 
@@ -3045,11 +3046,11 @@ void Gfx::opEndMarkedContent(Object args[], int numArgs) {
 
 void Gfx::opMarkPoint(Object args[], int numArgs) {
   if (printCommands) {
-    printf("  mark point: %s ", args[0].getName());
+    fprintf(stderr, "DEBUG2:   mark point: %s ", args[0].getName());
     if (numArgs == 2)
-      args[2].print(stdout);
-    printf("\n");
-    fflush(stdout);
+      args[2].print(stderr);
+    putc('\n', stderr);
+    fflush(stderr);
   }
 }
 
index e39c11c5e68cd86b88792fa83b9041b17de6ba88..dc47f17f2cbeef8d35985a20899ae7ff85f2cde3 100644 (file)
@@ -207,7 +207,7 @@ void PDFDoc::displayPage(OutputDev *out, int page, double hDPI, double vDPI,
   Page *p;
 
   if (globalParams->getPrintCommands()) {
-    printf("***** page %d *****\n", page);
+    fprintf(stderr, "DEBUG2: ***** page %d *****\n", page);
   }
   p = catalog->getPage(page);
   if (doLinks) {
index 897253901aa846eff2f065a936747207ed78a2ea..90b0602a9fb8fa26c214e0e36974d851ebb2a2d1 100644 (file)
@@ -299,13 +299,13 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI, int rotate,
   cropBox = getCropBox();
 
   if (globalParams->getPrintCommands()) {
-    printf("***** MediaBox = ll:%g,%g ur:%g,%g\n",
-          box.x1, box.y1, box.x2, box.y2);
+    fprintf(stderr, "DEBUG2: ***** MediaBox = ll:%g,%g ur:%g,%g\n",
+           box.x1, box.y1, box.x2, box.y2);
     if (isCropped()) {
-      printf("***** CropBox = ll:%g,%g ur:%g,%g\n",
-            cropBox->x1, cropBox->y1, cropBox->x2, cropBox->y2);
+      fprintf(stderr, "DEBUG2: ***** CropBox = ll:%g,%g ur:%g,%g\n",
+             cropBox->x1, cropBox->y1, cropBox->x2, cropBox->y2);
     }
-    printf("***** Rotate = %d\n", attrs->getRotate());
+    fprintf(stderr, "DEBUG2: ***** Rotate = %d\n", attrs->getRotate());
   }
 
   gfx = new Gfx(xref, out, num, attrs->getResourceDict(),
@@ -335,7 +335,7 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI, int rotate,
   obj.free();
   if (annotList->getNumAnnots() > 0) {
     if (globalParams->getPrintCommands()) {
-      printf("***** Annotations\n");
+      fprintf(stderr, "DEBUG2: ***** Annotations\n");
     }
     for (i = 0; i < annotList->getNumAnnots(); ++i) {
       annotList->getAnnot(i)->draw(gfx);
index 38c93c6ffc77ddf764950839cfe5acd0a13c9553..f1af3a1c7ffdaad06bbfd0e73e954155da6aa231 100644 (file)
@@ -1,5 +1,5 @@
 //
-// "$Id: pdftops.cxx,v 1.19 2004/02/02 22:41:09 mike Exp $"
+// "$Id: pdftops.cxx,v 1.20 2004/02/06 21:01:51 mike Exp $"
 //
 //   PDF to PostScript filter front-end for the Common UNIX Printing
 //   System (CUPS).
@@ -84,6 +84,7 @@ main(int  argc,                               // I - Number of command-line args
   int          temp;                   // Temporary var
   int          duplex;                 // Duplex the output?
   int          fit;                    // Fit the pages to the output
+  int          printCommands;          // Output debug info for commands?
 
 
   // Make sure status messages are not buffered...
@@ -227,6 +228,13 @@ main(int  argc,                            // I - Number of command-line args
        break;
   }
 
+  if ((val = cupsGetOption("debug", num_options, options)) != NULL &&
+      strcasecmp(val, "no") && strcasecmp(val, "off") &&
+      strcasecmp(val, "false"))
+    printCommands = 1;
+  else
+    printCommands = 0;
+
   if ((val = cupsGetOption("fitplot", num_options, options)) != NULL &&
       strcasecmp(val, "no") && strcasecmp(val, "off") &&
       strcasecmp(val, "false"))
@@ -284,7 +292,10 @@ main(int  argc,                            // I - Number of command-line args
   globalParams->setPSEmbedTrueType(1);
   globalParams->setPSEmbedCIDPostScript(1);
   globalParams->setErrQuiet(0);
-  globalParams->setPrintCommands(0);
+  globalParams->setPrintCommands(printCommands);
+
+  if (printCommands)
+    setbuf(stdout, NULL);
 
   // open PDF file
   doc = new PDFDoc(fileName, NULL, NULL);
@@ -327,5 +338,5 @@ main(int  argc,                             // I - Number of command-line args
 
 
 //
-// End of "$Id: pdftops.cxx,v 1.19 2004/02/02 22:41:09 mike Exp $".
+// End of "$Id: pdftops.cxx,v 1.20 2004/02/06 21:01:51 mike Exp $".
 //