/*
- * "$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.
*/
/*
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 ****/
* 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;
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)
{
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);
}
* 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;
{
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),
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
-
-
-/*
- * End of "$Id$".
- */