+#define O_BINARY 0
+#endif
+#endif
+#if O_BINARY
+#include <io.h>
+#define SET_BINARY(f) do { if (!isatty(f)) setmode(f,O_BINARY); } while (0)
+#endif
+#endif
+
+/* Not all printable characters have ASCII codes (depending upon the
+ LOCALE set) but on some older systems it is not safe to test isprint
+ without first testing isascii... */
+#if defined isascii && !defined HAVE_LOCALE_H
+#define isgraphic(c) (isascii (c) && (isprint (c) || (c) == '\t'))
+#else
+#define isgraphic(c) (isprint (c) || (c) == '\t')