/*
- * "$Id: socket.c 7881 2008-08-28 20:21:56Z mike $"
+ * AppSocket backend for CUPS.
*
- * AppSocket backend for CUPS.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
- * Copyright 2007-2012 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/".
*
- * 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:
- *
- * main() - Send a file to the printer or server.
- * wait_bc() - Wait for back-channel data...
+ * This file is subject to the Apple OS-Developed Software exception.
*/
/*
* Local functions...
*/
-static int wait_bc(int device_fd, int secs);
+static ssize_t wait_bc(int device_fd, int secs);
/*
int print_fd; /* Print file */
int copies; /* Number of copies to print */
time_t start_time; /* Time of first connect */
-#ifdef __APPLE__
- time_t current_time, /* Current time */
- wait_time; /* Time to wait before shutting down socket */
-#endif /* __APPLE__ */
int contimeout; /* Connection timeout */
int waiteof; /* Wait for end-of-file? */
int port; /* Port number */
*/
snmp_enabled = !value[0] || !_cups_strcasecmp(value, "on") ||
- _cups_strcasecmp(value, "yes") ||
- _cups_strcasecmp(value, "true");
+ !_cups_strcasecmp(value, "yes") ||
+ !_cups_strcasecmp(value, "true");
}
else if (!_cups_strcasecmp(name, "contimeout"))
{
break;
}
- sleep(delay);
+ sleep((unsigned)delay);
if (delay < 30)
delay += 5;
fprintf(stderr, "DEBUG: Connected to %s:%d...\n",
httpAddrString(&(addr->addr), addrname, sizeof(addrname)),
- _httpAddrPort(&(addr->addr)));
+ httpAddrPort(&(addr->addr)));
/*
* Print everything...
tbytes = 0;
if (bytes > 0)
- tbytes += write(device_fd, buffer, bytes);
+ tbytes += write(device_fd, buffer, (size_t)bytes);
while (copies > 0 && tbytes >= 0)
{
_cupsLangPrintFilter(stderr, "INFO", _("Print file sent."));
}
-#ifdef __APPLE__
- /*
- * Wait up to 5 seconds to get any pending back-channel data...
- */
-
- wait_time = time(NULL) + 5;
- while (wait_time >= time(¤t_time))
- if (wait_bc(device_fd, wait_time - current_time) <= 0)
- break;
-#endif /* __APPLE__ */
+ fputs("STATE: +cups-waiting-for-job-completed\n", stderr);
if (waiteof)
{
* 'wait_bc()' - Wait for back-channel data...
*/
-static int /* O - # bytes read or -1 on error */
+static ssize_t /* O - # bytes read or -1 on error */
wait_bc(int device_fd, /* I - Socket */
int secs) /* I - Seconds to wait */
{
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data\n",
(int)bytes);
- cupsBackChannelWrite(buffer, bytes, 1.0);
+ cupsBackChannelWrite(buffer, (size_t)bytes, 1.0);
}
return (bytes);
else
return (-1);
}
-
-
-/*
- * End of "$Id: socket.c 7881 2008-08-28 20:21:56Z mike $".
- */