~ubuntu-branches/ubuntu/utopic/gettext/utopic

« back to all changes in this revision

Viewing changes to gettext-tools/gnulib-lib/binary-io.h

  • Committer: Colin Watson
  • Date: 2010-08-01 21:36:08 UTC
  • mfrom: (2.1.10 sid)
  • Revision ID: cjwatson@canonical.com-20100801213608-yy7vkm8lpatep3ci
merge from Debian 0.18.1.1-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Binary mode I/O.
2
 
   Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
 
2
   Copyright (C) 2001, 2003, 2005, 2008, 2009, 2010 Free Software Foundation,
 
3
   Inc.
3
4
 
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
32
33
#endif
33
 
#ifdef __BEOS__
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.  */
35
36
# undef O_BINARY
36
37
# undef O_TEXT
37
38
#endif
 
39
 
 
40
/* SET_BINARY (fd);
 
41
   changes the file descriptor fd to perform binary I/O.  */
38
42
#if O_BINARY
39
 
# if !(defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__)
 
43
# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
 
44
#  include <io.h> /* declares setmode() */
 
45
# else
40
46
#  define setmode _setmode
41
47
#  undef fileno
42
48
#  define fileno _fileno
43
49
# endif
44
 
# if defined __DJGPP__ || defined __CYGWIN__
45
 
#  include <io.h> /* declares setmode() */
46
 
# endif
47
50
# ifdef __DJGPP__
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))
53
56
# else
54
 
#  define SET_BINARY(fd) setmode (fd, O_BINARY)
 
57
#  define SET_BINARY(fd) ((void) setmode (fd, O_BINARY))
55
58
# endif
56
59
#else
57
60
  /* On reasonable systems, binary I/O is the default.  */
58
61
# undef O_BINARY
59
62
# define O_BINARY 0
60
 
# define SET_BINARY(fd) /* nothing */
 
63
# define SET_BINARY(fd) /* do nothing */ ((void) 0)
61
64
#endif
62
65
 
63
66
#endif /* _BINARY_H */