]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/usb.c
Off by one error in ipp_finishings_vendor
[thirdparty/cups.git] / backend / usb.c
index 74cd6e580cf11cbbbe183496ecde25f9d83fde21..e1b2c03dc9af22f27e0013d779b4728e1a2468b3 100644 (file)
@@ -1,24 +1,11 @@
 /*
- * "$Id: usb.c 7687 2008-06-24 01:28:36Z mike $"
+ * USB printer backend for CUPS.
  *
- *   USB port backend for the Common UNIX Printing System (CUPS).
+ * Copyright © 2007-2012 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   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
- *   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, see the license at "http://www.cups.org/".
- *
- *   This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- *   list_devices() - List all available USB devices to stdout.
- *   print_device() - Print a file to a USB device.
- *   main()         - Send a file to the specified USB port.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  */
 
 /*
 
 #include "backend-private.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 #  include <io.h>
 #else
 #  include <unistd.h>
 #  include <fcntl.h>
 #  include <termios.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 
 /*
@@ -55,7 +42,7 @@ int   print_device(const char *uri, const char *hostname,
  * Include the vendor-specific USB implementation...
  */
 
-#ifdef HAVE_USB_H
+#ifdef HAVE_LIBUSB
 #  include "usb-libusb.c"
 #elif defined(__APPLE__)
 #  include "usb-darwin.c"
@@ -118,7 +105,7 @@ print_device(const char *uri,               /* I - Device URI */
 
   return (CUPS_BACKEND_FAILED);
 }
-#endif /* __APPLE__ */
+#endif /* HAVE_LIBUSB */
 
 
 /*
@@ -180,7 +167,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   else if (argc < 6 || argc > 7)
   {
     _cupsLangPrintf(stderr,
-                    _("Usage: %s job-id user title copies options [file]\n"),
+                    _("Usage: %s job-id user title copies options [file]"),
                     argv[0]);
     return (CUPS_BACKEND_FAILED);
   }
@@ -196,9 +183,9 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
                      hostname, sizeof(hostname), &port,
                      resource, sizeof(resource)) < HTTP_URI_OK)
   {
-    _cupsLangPuts(stderr,
-                 _("ERROR: No device URI found in argv[0] or in DEVICE_URI "
-                    "environment variable\n"));
+    _cupsLangPrintFilter(stderr, "ERROR",
+                        _("No device URI found in argv[0] or in DEVICE_URI "
+                           "environment variable."));
     return (1);
   }
 
@@ -234,8 +221,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
     if ((print_fd = open(argv[6], O_RDONLY)) < 0)
     {
-      _cupsLangPrintf(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);
     }
 
@@ -258,8 +244,3 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
   return (status);
 }
-
-
-/*
- * End of "$Id: usb.c 7687 2008-06-24 01:28:36Z mike $".
- */