/*
- * "$Id$"
+ * TBCP port monitor for CUPS.
*
- * TBCP port monitor for CUPS.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products.
*
- * Copyright 2007-2010 by Apple Inc.
- * Copyright 1993-2006 by Easy Software Products.
- *
- * 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"
- * which should have been included with this file. If this file is
- * 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() - Main entry...
- * psgets() - Get a line from a file.
- * pswrite() - Write data from a file.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
*/
static char *psgets(char *buf, size_t *bytes, FILE *fp);
-static size_t pswrite(const char *buf, size_t bytes, FILE *fp);
+static ssize_t pswrite(const char *buf, size_t bytes);
/*
if (psgets(line, &linelen, fp) == NULL)
break;
}
- while (pswrite(line, linelen, stdout) > 0);
+ while (pswrite(line, linelen) > 0);
fflush(stdout);
}
bufptr = buf;
ch = EOF;
- while ((bufptr - buf) < len)
+ while ((size_t)(bufptr - buf) < len)
{
if ((ch = getc(fp)) == EOF)
break;
else if (ch == '\n')
break;
else
- *bufptr++ = ch;
+ *bufptr++ = (char)ch;
}
/*
if (ch == '\n' || ch == '\r')
{
- if ((bufptr - buf) < len)
- *bufptr++ = ch;
+ if ((size_t)(bufptr - buf) < len)
+ *bufptr++ = (char)ch;
else
ungetc(ch, fp);
}
*/
*bufptr = '\0';
- *bytes = bufptr - buf;
+ *bytes = (size_t)(bufptr - buf);
if (ch == EOF && bufptr == buf)
return (NULL);
* 'pswrite()' - Write data from a file.
*/
-static size_t /* O - Number of bytes written */
+static ssize_t /* O - Number of bytes written */
pswrite(const char *buf, /* I - Buffer to write */
- size_t bytes, /* I - Bytes to write */
- FILE *fp) /* I - File to write to */
+ size_t bytes) /* I - Bytes to write */
{
size_t count; /* Remaining bytes */
break;
}
- return (bytes);
+ return ((ssize_t)bytes);
}
-
-
-/*
- * End of "$Id$".
- */