]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/usb.c
More localization work.
[thirdparty/cups.git] / backend / usb.c
index 91876047513904eae6efcbbe9514bc49f916db8e..08addb478f6439ccb31af0bca5df464d23d75f31 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   USB port backend for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2009 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
 #  include <ApplicationServices/ApplicationServices.h>
 #endif /* __APPLE__ */
 
-#include <cups/backend.h>
-#include <cups/cups.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <cups/string.h>
-#include <cups/i18n.h>
-#include <signal.h>
+#include "backend-private.h"
 
 #ifdef WIN32
 #  include <io.h>
@@ -54,7 +47,7 @@
 
 void   list_devices(void);
 int    print_device(const char *uri, const char *hostname,
-                    const char *resource, const char *options,
+                    const char *resource, char *options,
                     int print_fd, int copies, int argc, char *argv[]);
 
 
@@ -62,9 +55,11 @@ int  print_device(const char *uri, const char *hostname,
  * Include the vendor-specific USB implementation...
  */
 
-#ifdef __APPLE__
+#ifdef HAVE_USB_H
+#  include "usb-libusb.c"
+#elif defined(__APPLE__)
 #  include "usb-darwin.c"
-#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
 #  include "usb-unix.c"
 #else
 /*
@@ -99,7 +94,7 @@ int                                   /* O - Exit status */
 print_device(const char *uri,          /* I - Device URI */
              const char *hostname,     /* I - Hostname/manufacturer */
              const char *resource,     /* I - Resource/modelname */
-            const char *options,       /* I - Device options/serial number */
+            char       *options,       /* I - Device options/serial number */
             int        print_fd,       /* I - File descriptor to print */
             int        copies,         /* I - Copies to print */
             int        argc,           /* I - Number of command-line arguments (6 or 7) */
@@ -184,8 +179,9 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   }
   else if (argc < 6 || argc > 7)
   {
-    fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
-            argv[0]);
+    _cupsLangPrintf(stderr,
+                    _("Usage: %s job-id user title copies options [file]"),
+                    argv[0]);
     return (CUPS_BACKEND_FAILED);
   }
 
@@ -200,8 +196,9 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
                      hostname, sizeof(hostname), &port,
                      resource, sizeof(resource)) < HTTP_URI_OK)
   {
-    fputs(_("ERROR: No device URI found in argv[0] or in DEVICE_URI "
-           "environment variable!\n"), stderr);
+    _cupsLangPrintFilter(stderr, "ERROR",
+                        _("No device URI found in argv[0] or in DEVICE_URI "
+                           "environment variable."));
     return (1);
   }
 
@@ -237,8 +234,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
     if ((print_fd = open(argv[6], O_RDONLY)) < 0)
     {
-      fprintf(stderr, _("ERROR: Unable to open print file %s - %s\n"),
-              argv[6], strerror(errno));
+      _cupsLangPrintError("ERROR", _("Unable to open print file"));
       return (CUPS_BACKEND_FAILED);
     }