]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/parallel.c
Load cups into easysw/current.
[thirdparty/cups.git] / backend / parallel.c
index 4164e789596b2f7c43e3b419b3908147f770f8e8..febedf6f914a485a27399b6e5359abceeb493555 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: parallel.c 6178 2007-01-03 18:09:17Z mike $"
+ * "$Id: parallel.c 6649 2007-07-11 21:46:42Z mike $"
  *
  *   Parallel port backend for the Common UNIX Printing System (CUPS).
  *
+ *   Copyright 2007 by Apple Inc.
  *   Copyright 1997-2007 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
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
  *   "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 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  *   This file is subject to the Apple OS-Developed Software exception.
  *
@@ -131,7 +122,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   }
   else if (argc < 6 || argc > 7)
   {
-    fputs("Usage: parallel job-id user title copies options [file]\n", stderr);
+    fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
+           argv[0]);
     return (CUPS_BACKEND_FAILED);
   }
 
@@ -221,8 +213,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
        * available printer in the class.
        */
 
-        fputs("INFO: Unable to open parallel port, queuing on next printer "
-             "in class...\n", stderr);
+        fputs(_("INFO: Unable to contact printer, queuing on next "
+               "printer in class...\n"), stderr);
 
        /*
         * Sleep 5 seconds to keep the job from requeuing too rapidly...
@@ -235,20 +227,18 @@ main(int  argc,                           /* I - Number of command-line arguments (6 or 7) */
 
       if (errno == EBUSY)
       {
-        fputs("INFO: Parallel port busy; will retry in 30 seconds...\n",
-             stderr);
+        fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr);
        sleep(30);
       }
       else if (errno == ENXIO || errno == EIO || errno == ENOENT)
       {
-        fputs("INFO: Printer not connected; will retry in 30 seconds...\n",
+        fputs(_("INFO: Printer not connected; will retry in 30 seconds...\n"),
              stderr);
        sleep(30);
       }
       else
       {
-       fprintf(stderr,
-               "ERROR: Unable to open parallel port device file \"%s\": %s\n",
+       fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"),
                resource, strerror(errno));
        return (CUPS_BACKEND_FAILED);
       }
@@ -289,8 +279,13 @@ main(int  argc,                            /* I - Number of command-line arguments (6 or 7) */
     tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
 
     if (print_fd != 0 && tbytes >= 0)
-      fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
-             CUPS_LLCAST tbytes);
+      fprintf(stderr,
+#ifdef HAVE_LONG_LONG
+              _("INFO: Sent print file, %lld bytes...\n"),
+#else
+              _("INFO: Sent print file, %ld bytes...\n"),
+#endif /* HAVE_LONG_LONG */
+              CUPS_LLCAST tbytes);
   }
 
  /*
@@ -618,14 +613,16 @@ side_cb(int print_fd,                     /* I - Print file */
 
   if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
   {
-    fputs("WARNING: Failed to read side-channel request!\n", stderr);
+    fputs(_("WARNING: Failed to read side-channel request!\n"), stderr);
     return;
   }
 
   switch (command)
   {
     case CUPS_SC_CMD_DRAIN_OUTPUT :
-        if (tcdrain(device_fd))
+        if (backendDrainOutput(print_fd, device_fd))
+         status = CUPS_SC_STATUS_IO_ERROR;
+       else if (tcdrain(device_fd))
          status = CUPS_SC_STATUS_IO_ERROR;
        else
          status = CUPS_SC_STATUS_OK;
@@ -665,5 +662,5 @@ side_cb(int print_fd,                       /* I - Print file */
 
 
 /*
- * End of "$Id: parallel.c 6178 2007-01-03 18:09:17Z mike $".
+ * End of "$Id: parallel.c 6649 2007-07-11 21:46:42Z mike $".
  */