]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/usb-unix.c
Update ipp documentation to reflect the behavior of configuring WiFi on IPP USB printers.
[thirdparty/cups.git] / backend / usb-unix.c
index ae344a4d43c4440956c26268340947cb45557abb..d256a813ba80e4b4868e891f70102028b98c3740 100644 (file)
@@ -1,20 +1,13 @@
 /*
- * "$Id$"
- *
  * USB port backend for CUPS.
  *
  * This file is included from "usb.c" when compiled on UNIX/Linux.
  *
- * Copyright 2007-2013 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/".
+ * Copyright © 2007-2013 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
- * This file is subject to the Apple OS-Developed Software exception.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  */
 
 /*
@@ -146,7 +139,7 @@ print_device(const char *uri,               /* I - Device URI */
 
   tcgetattr(device_fd, &opts);
 
-  opts.c_lflag &= ~(ICANON | ECHO | ISIG);     /* Raw mode */
+  opts.c_lflag &= ~(unsigned)(ICANON | ECHO | ISIG);   /* Raw mode */
 
   /**** No options supported yet ****/
 
@@ -221,21 +214,21 @@ list_devices(void)
     * for USB printer devices.  We get the honor of trying them all...
     */
 
-    sprintf(device, "/dev/usblp%d", i);
+    snprintf(device, sizeof(device), "/dev/usblp%d", i);
 
     if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
     {
       if (errno != ENOENT)
        continue;
 
-      sprintf(device, "/dev/usb/lp%d", i);
+      snprintf(device, sizeof(device), "/dev/usb/lp%d", i);
 
       if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
       {
        if (errno != ENOENT)
          continue;
 
-       sprintf(device, "/dev/usb/usblp%d", i);
+       snprintf(device, sizeof(device), "/dev/usb/usblp%d", i);
 
        if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
          continue;
@@ -265,7 +258,7 @@ list_devices(void)
 
   for (i = 0; i < 8; i ++)
   {
-    sprintf(device, "/dev/usb/printer%d", i);
+    snprintf(device, sizeof(device), "/dev/usb/printer%d", i);
 
     if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
     {
@@ -285,11 +278,11 @@ list_devices(void)
 
   for (i = 0; i < 8; i ++)
   {
-    sprintf(device, "/dev/ulpt%d", i);
+    snprintf(device, sizeof(device), "/dev/ulpt%d", i);
     if (!access(device, 0))
       printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
 
-    sprintf(device, "/dev/unlpt%d", i);
+    snprintf(device, sizeof(device), "/dev/unlpt%d", i);
     if (!access(device, 0))
       printf("direct usb:%s \"Unknown\" \"USB Printer #%d (no reset)\"\n", device, i + 1);
   }
@@ -351,15 +344,15 @@ open_device(const char *uri,              /* I - Device URI */
        * for USB printer devices.  We get the honor of trying them all...
        */
 
-       sprintf(device, "/dev/usblp%d", i);
+       snprintf(device, sizeof(device), "/dev/usblp%d", i);
 
        if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
        {
-         sprintf(device, "/dev/usb/lp%d", i);
+         snprintf(device, sizeof(device), "/dev/usb/lp%d", i);
 
          if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
          {
-           sprintf(device, "/dev/usb/usblp%d", i);
+           snprintf(device, sizeof(device), "/dev/usb/usblp%d", i);
 
            if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
              continue;
@@ -447,7 +440,7 @@ open_device(const char *uri,                /* I - Device URI */
     {
       for (i = 0, busy = 0; i < 8; i ++)
       {
-       sprintf(device, "/dev/usb/printer%d", i);
+       snprintf(device, sizeof(device), "/dev/usb/printer%d", i);
 
        if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
          backendGetDeviceID(fd, device_id, sizeof(device_id),
@@ -600,8 +593,3 @@ side_cb(int         print_fd,               /* I - Print file */
 
   return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
 }
-
-
-/*
- * End of "$Id$".
- */