Mercurial > hg > octave-nkf > gnulib-hg
annotate lib/binary-io.h @ 6259:96c32553b4c6
Use a consistent style for including <config.h>.
* __fpending.c, acl.c, argmatch.c,
argp-help.c, argp-parse.c,
argp-pvh.c, backupfile.c, basename.c, c-stack.c,
calloc.c, check-version.c, cloexec.c, closeout.c, copy-file.c,
creat-safer.c, cycle-check.c, dirfd.c, dirname.c, dup-safer.c,
dup2.c, euidaccess.c, exclude.c, exitfail.c, fatal-signal.c,
fd-safer.c, file-type.c, fileblocks.c, filemode.c,
filenamecat.c, findprog.c, fnmatch.c, fopen-safer.c, free.c,
fsusage.c, ftruncate.c, full-write.c, fwriteerror.c,
getaddrinfo.c, getcwd.c, getdelim.c, getline.c, getlogin_r.c,
getndelim2.c, getnline.c, getopt1.c, getpass.c, group-member.c,
hard-locale.c, hash-pjw.c, hash.c, human.c, idcache.c,
inet_ntop.c, isdir.c, long-options.c, malloc.c, memcasecmp.c,
memcmp.c, memcoll.c, memcpy.c, memmove.c, mkdir-p.c,
modechange.c, mountlist.c, open-safer.c, physmem.c,
pipe-safer.c, pipe.c, poll.c, posixver.c, progname.c,
progreloc.c, putenv.c, quote.c, quotearg.c, readline.c,
readlink.c, realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c,
safe-read.c, same.c, save-cwd.c, savedir.c, sig2str.c,
strcspn.c, strerror.c, stripslash.c, strncasecmp.c, strndup.c,
strnlen.c, strnlen1.c, strsep.c, strstr.c, strtod.c,
strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c,
userspec.c, utimecmp.c, version-etc-fsf.c,
version-etc.c, wait-process.c, xalloc-die.c, xgetcwd.c,
xmalloc.c, xmemcoll.c, xnanosleep.c, xreadlink.c, xsetenv.c,
xstrndup.c, xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c:
Standardize inclusion of config.h.
* __fpending.h, dirfd.h, getdate.h, human.h,
inttostr.h: Removed inclusion of config.h from header files.
* inttostr.c: Adjusted in-tree users.
* timespec.h: Remove superfluous warning to include config.h.
* atexit.c, chdir-long.c chown.c, fchown-stub.c, getgroups.c,
gettimeofday.c, lchown.c, lstat.c, mkdir.c, mkstemp.c,
nanosleep.c, openat.c, raise.c, readtokens0.c, readutmp.c,
unlinkdir.c: Guard inclusion of config.h with HAVE_CONFIG_H.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 19 Sep 2005 17:28:14 +0000 (2005-09-19) |
parents | e9721cce07d6 |
children | bbbbbf4cd1c5 |
rev | line source |
---|---|
4273 | 1 /* Binary mode I/O. |
5916
e9721cce07d6
Avoid gcc warning on mingw.
Bruno Haible <bruno@clisp.org>
parents:
5848
diff
changeset
|
2 Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. |
4273 | 3 |
4 This program is free software; you can redistribute it and/or modify | |
5 it under the terms of the GNU General Public License as published by | |
6 the Free Software Foundation; either version 2, or (at your option) | |
7 any later version. | |
8 | |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
15 along with this program; if not, write to the Free Software Foundation, | |
5848
a48fb0e98c8c
*** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents:
4928
diff
changeset
|
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
4273 | 17 |
18 #ifndef _BINARY_H | |
19 #define _BINARY_H | |
20 | |
21 /* For systems that distinguish between text and binary I/O. | |
22 O_BINARY is usually declared in <fcntl.h>. */ | |
4608 | 23 #include <fcntl.h> |
24 | |
25 /* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...', | |
26 so we include it here first. */ | |
27 #include <stdio.h> | |
28 | |
4273 | 29 #if !defined O_BINARY && defined _O_BINARY |
30 /* For MSC-compatible compilers. */ | |
31 # define O_BINARY _O_BINARY | |
32 # define O_TEXT _O_TEXT | |
33 #endif | |
34 #ifdef __BEOS__ | |
35 /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ | |
36 # undef O_BINARY | |
37 # undef O_TEXT | |
38 #endif | |
39 #if O_BINARY | |
4928
6904dd9a5ccf
Avoid compilation warnings on Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
4611
diff
changeset
|
40 # if !(defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__) |
4273 | 41 # define setmode _setmode |
5916
e9721cce07d6
Avoid gcc warning on mingw.
Bruno Haible <bruno@clisp.org>
parents:
5848
diff
changeset
|
42 # undef fileno |
4273 | 43 # define fileno _fileno |
44 # endif | |
4928
6904dd9a5ccf
Avoid compilation warnings on Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
4611
diff
changeset
|
45 # if defined __DJGPP__ || defined __CYGWIN__ |
6904dd9a5ccf
Avoid compilation warnings on Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
4611
diff
changeset
|
46 # include <io.h> /* declares setmode() */ |
6904dd9a5ccf
Avoid compilation warnings on Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
4611
diff
changeset
|
47 # endif |
4273 | 48 # ifdef __DJGPP__ |
49 # include <unistd.h> /* declares isatty() */ | |
50 # /* Avoid putting stdin/stdout in binary mode if it is connected to the | |
51 # console, because that would make it impossible for the user to | |
52 # interrupt the program through Ctrl-C or Ctrl-Break. */ | |
53 # define SET_BINARY(fd) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0) | |
54 # else | |
55 # define SET_BINARY(fd) setmode (fd, O_BINARY) | |
56 # endif | |
57 #else | |
58 /* On reasonable systems, binary I/O is the default. */ | |
4611 | 59 # undef O_BINARY |
4273 | 60 # define O_BINARY 0 |
61 # define SET_BINARY(fd) /* nothing */ | |
62 #endif | |
63 | |
64 #endif /* _BINARY_H */ |