/*
- * "$Id: testfile.c 7560 2008-05-13 06:34:04Z mike $"
+ * "$Id: testfile.c 7720 2008-07-11 22:46:21Z mike $"
*
* File test program for the Common UNIX Printing System (CUPS).
*
#ifdef HAVE_LIBZ
# include <zlib.h>
#endif /* HAVE_LIBZ */
-#include <unistd.h>
+#ifdef WIN32
+# include <io.h>
+#else
+# include <unistd.h>
+#endif /* WIN32 */
#include <fcntl.h>
int status; /* Exit status */
char filename[1024]; /* Filename buffer */
cups_file_t *fp; /* File pointer */
+#ifndef WIN32
int fds[2]; /* Open file descriptors */
cups_file_t *fdfile; /* File opened with cupsFileOpenFd() */
+#endif /* !WIN32 */
int count; /* Number of lines in file */
* Do uncompressed random I/O tests...
*/
- status = random_tests();
+ status += random_tests();
+#ifndef WIN32
/*
* Test fdopen and close without reading...
*/
puts("PASS");
}
+#endif /* !WIN32 */
/*
* Count lines in euc-jp.txt, rewind, then count again.
fputs("cupsFileSeek(), cupsFileRead(): ", stdout);
for (num_records = (pass + 1) * 256, count = (pass + 1) * 256,
- record = rand() % num_records;
+ record = CUPS_RAND() % num_records;
count > 0;
- count --, record = (record + (rand() & 31) - 16 + num_records) %
+ count --, record = (record + (CUPS_RAND() & 31) - 16 + num_records) %
num_records)
{
/*
* Initialize the write buffer with random data...
*/
-#ifdef WIN32
- srand((unsigned)time(NULL));
-#else
- srand(time(NULL));
-#endif /* WIN32 */
+ CUPS_SRAND(time(NULL));
for (i = 0; i < (int)sizeof(writebuf); i ++)
- writebuf[i] = rand();
+ writebuf[i] = CUPS_RAND();
/*
* cupsFileOpen(write)
fputs("cupsFileGetChar(partial line): ", stdout);
- for (i = 0; i < strlen(partial_line); i ++)
+ for (i = 0; i < (int)strlen(partial_line); i ++)
if ((byte = cupsFileGetChar(fp)) < 0)
break;
else if (byte != partial_line[i])
/*
- * End of "$Id: testfile.c 7560 2008-05-13 06:34:04Z mike $".
+ * End of "$Id: testfile.c 7720 2008-07-11 22:46:21Z mike $".
*/