]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/usb-darwin.c
Merge changes from CUPS 1.4svn-r7199.
[thirdparty/cups.git] / backend / usb-darwin.c
index d90c85361eb7c4d1a2037ddd15cae4075aab180c..88a7a40766e71302578013945ec6e5593ef426dc 100644 (file)
@@ -1,7 +1,7 @@
 /*
-* "$Id: usb-darwin.c 6996 2007-09-28 18:30:31Z mike $"
+* "$Id: usb-darwin.c 6993 2007-09-28 18:05:28Z mike $"
 *
-* Copyright � 2005-2007 Apple Inc. All rights reserved.
+* Copyright � 2005-2008 Apple Inc. All rights reserved.
 *
 * IMPORTANT:  This Apple software is supplied to you by Apple Computer,
 * Inc. ("Apple") in consideration of your agreement to the following
@@ -600,7 +600,7 @@ print_device(const char *uri,               /* I - Device URI */
 
          if (errno != EAGAIN || errno != EINTR)
          {
-           perror("ERROR: Unable to read print data");
+           _cupsLangPrintError(_("ERROR: Unable to read print data"));
            return CUPS_BACKEND_STOP;
          }
 
@@ -1131,7 +1131,7 @@ static Boolean find_device_cb(void *refcon,
   if (!keepLooking && g.status_timer != NULL)
   {
     fputs("STATE: -offline-error\n", stderr);
-    _cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n"));
+    _cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
     CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode);
     CFRelease(g.status_timer);
     g.status_timer = NULL;
@@ -1149,7 +1149,23 @@ static void status_timer_cb(CFRunLoopTimerRef timer,
                            void *info)
 {
   fputs("STATE: +offline-error\n", stderr);
-  _cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
+  _cupsLangPuts(stderr, _("INFO: Printer is currently offline.\n"));
+
+  if (getenv("CLASS") != NULL)
+  {
+   /*
+    * If the CLASS environment variable is set, the job was submitted
+    * to a class and not to a specific queue.  In this case, we want
+    * to abort immediately so that the job can be requeued on the next
+    * available printer in the class.
+    *
+    * Sleep 5 seconds to keep the job from requeuing too rapidly...
+    */
+
+    sleep(5);
+
+    exit(CUPS_BACKEND_FAILED);
+  }
 }
 
 
@@ -1782,7 +1798,7 @@ static void run_ppc_backend(int argc,
 
       execv("/usr/libexec/cups/backend/usb", my_argv);
 
-      perror("/usr/libexec/cups/backend/usb");
+      _cupsLangPrintError(_("ERROR: Unable to exec /usr/libexec/cups/backend/usb"));
       exit(errno);
     }
     else if (child_pid < 0)
@@ -1791,7 +1807,7 @@ static void run_ppc_backend(int argc,
       * Error - couldn't fork a new process!
       */
 
-      perror("fork");
+      _cupsLangPrintError(_("ERROR: Unable to fork"));
       exit(errno);
     }
 
@@ -2017,5 +2033,5 @@ static void get_device_id(cups_sc_status_t *status,
 
 
 /*
- * End of "$Id: usb-darwin.c 6996 2007-09-28 18:30:31Z mike $".
+ * End of "$Id: usb-darwin.c 6993 2007-09-28 18:05:28Z mike $".
  */