diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-04-12 07:44:35 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-04-12 07:44:35 +0000 |
commit | 6fc04adf128379f0efac92966a52865fb5f87e29 (patch) | |
tree | 4e4d0d263fe886920b4fb5c305877cace78cc61d /lib | |
parent | 6243e2580a0a84026f75edb2a54edfc39d39825e (diff) | |
download | diffutils-6fc04adf128379f0efac92966a52865fb5f87e29.tar.gz |
(__attribute__): New macro.
(set_binary_mode): Define only if HAVE_SETMODE_DOS.
Otherwise define a dummy static char, as C89 requires
that we define something.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/setmode.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/setmode.c b/lib/setmode.c index dbcf44e..b2b93a6 100644 --- a/lib/setmode.c +++ b/lib/setmode.c @@ -1,6 +1,6 @@ /* Set a file descriptor's mode to binary or to text. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,6 +42,11 @@ typedef enum {false = 0, true = 1} bool; #include "setmode.h" #undef set_binary_mode +#ifndef __attribute__ +# if __GNUC__ < 3 || __STRICT_ANSI__ +# define __attribute__(x) +# endif +#endif /* Set the binary mode of FD to MODE, returning its previous mode. MODE is 1 for binary and 0 for text. If setting the mode might @@ -49,14 +54,14 @@ typedef enum {false = 0, true = 1} bool; 1 on POSIX platforms, which do not distinguish between text and binary. */ +#if HAVE_SETMODE_DOS bool set_binary_mode (int fd, bool mode) { -#if HAVE_SETMODE_DOS if (isatty (fd)) return mode; return setmode (fd, mode ? O_BINARY : O_TEXT) != O_TEXT; +} #else - return 1; +static char dummy; #endif -} |