2
Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
2
Copyright (C) 2001, 2003, 2005, 2008, 2009, 2010 Free Software Foundation,
4
5
This program is free software: you can redistribute it and/or modify
5
6
it under the terms of the GNU General Public License as published by
30
31
# define O_BINARY _O_BINARY
31
32
# define O_TEXT _O_TEXT
34
/* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
34
#if defined __BEOS__ || defined __HAIKU__
35
/* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
41
changes the file descriptor fd to perform binary I/O. */
39
# if !(defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__)
43
# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
44
# include <io.h> /* declares setmode() */
40
46
# define setmode _setmode
42
48
# define fileno _fileno
44
# if defined __DJGPP__ || defined __CYGWIN__
45
# include <io.h> /* declares setmode() */
48
51
# include <unistd.h> /* declares isatty() */
49
# /* Avoid putting stdin/stdout in binary mode if it is connected to the
50
# console, because that would make it impossible for the user to
51
# interrupt the program through Ctrl-C or Ctrl-Break. */
52
# define SET_BINARY(fd) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0)
52
/* Avoid putting stdin/stdout in binary mode if it is connected to
53
the console, because that would make it impossible for the user
54
to interrupt the program through Ctrl-C or Ctrl-Break. */
55
# define SET_BINARY(fd) ((void) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0))
54
# define SET_BINARY(fd) setmode (fd, O_BINARY)
57
# define SET_BINARY(fd) ((void) setmode (fd, O_BINARY))
57
60
/* On reasonable systems, binary I/O is the default. */
59
62
# define O_BINARY 0
60
# define SET_BINARY(fd) /* nothing */
63
# define SET_BINARY(fd) /* do nothing */ ((void) 0)
63
66
#endif /* _BINARY_H */