# include <unistd.h>
#endif
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
#ifdef HAVE_IO_H
# include <io.h>
#endif
+#ifdef NEED_LIBPORT
+# include "libport.h"
+#endif
+
#include "tiffio.h"
float defxres = 204.; /* default x resolution (pixels/inch) */
uint16 pn = (uint16) -1;
uint16 ptotal = (uint16) -1;
if (GetPageNumber(tif)) {
- while (pn != pageNumber && TIFFReadDirectory(tif) && GetPageNumber(tif))
+ while (pn != (pageNumber-1) && TIFFReadDirectory(tif) && GetPageNumber(tif))
;
- return (pn == pageNumber);
+ return (pn == (pageNumber-1));
} else
return (TIFFSetDirectory(tif, (tdir_t)(pageNumber-1)));
}
fd = tmpfile();
if (fd == NULL) {
- fprintf(stderr, "Could not create temporary file, exiting.\n");
- fclose(fd);
+ fprintf(stderr, "Could not obtain temporary file.\n");
exit(-2);
}
+#if defined(HAVE_SETMODE) && defined(O_BINARY)
+ setmode(fileno(stdin), O_BINARY);
+#endif
while ((n = read(fileno(stdin), buf, sizeof (buf))) > 0)
write(fileno(fd), buf, n);
lseek(fileno(fd), 0, SEEK_SET);
}
/* vim: set ts=8 sts=8 sw=8 noet: */
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */