summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-01-05 07:08:23 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-01-05 07:08:23 +0000
commit91b8605708cf2d7c49679a46a80b4039167da2cd (patch)
tree6972aba10c298cc28c3511b03647ead2ddc42765 /src/system.h
parent174ab8396535806d77708990568f9817d11d5bb3 (diff)
downloaddiffutils-91b8605708cf2d7c49679a46a80b4039167da2cd.tar.gz
* src/cmp.c: Don't include <setmode.h>.
(specify_ignore_initial): Reword to avoid gcc -W warnings. (main): Use freopen instead of setmode, since freopen is in POSIX. * src/context.c: Revert most 2004-09-01 changes. Then: (TIMESPEC_NS): Remove. All uses replaced by get_stat_mtime_ns. Include stat-time.h, strftime.h. (nstrtime): Remove decl. * src/diff.c: Revert most 2004-09-01 changes. Then: Don't include <posixver.h>, <quotesys.h>, <setmode.h>. Include <sh-quote.h>, <stat-time.h>, <timespec.h>. All uses of quotesys replaced by sh-quote. (main, compare_files): Use freopen instead of setmode, since freopen is in POSIX. (main): Don't complain about "diff -NUM'. (main, set_mtime_to_now): Adjust to stat-time.h macros when accessing nanoseconds. * src/diff3.c: Include sh-quote.h rather than quotesys. All uses changed. * src/dir.c (dir_read): excluded_filename renamed to excluded_file_name. * src/io.c: Don't include <setmode.h>. (sip, read_files): Remove binary file stuff, leaving a FIXME behind. A DOS expert needs to look at this. * src/diff.c: Include sh-quote.h rather than quotesys.h. All uses changed. * src/system.h: Include verify.h. (verify): Remove. All uses changed to verify.h version. Include <intprops.h>. (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove. Now uses intprops.h versions. (O_BINARY): New defns, taken from coreutils. * src/util.c: Include sh-quote.h rather than quotesys.h. All uses changed.
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/system.h b/src/system.h
index e480cc5..bf0da79 100644
--- a/src/system.h
+++ b/src/system.h
@@ -1,7 +1,7 @@
/* System dependent declarations.
Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002,
- 2004 Free Software Foundation, Inc.
+ 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU DIFF.
@@ -37,26 +37,7 @@
# define volatile
#endif
-/* Verify a requirement at compile-time (unlike assert, which is runtime). */
-#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
-
-
-/* Determine whether an integer type is signed, and its bounds.
- This code assumes two's (or one's!) complement with no holes. */
-
-/* The extra casts work around common compiler bugs,
- e.g. Cray C 5.0.3.0 when t == time_t. */
-#ifndef TYPE_SIGNED
-# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-#endif
-#ifndef TYPE_MINIMUM
-# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
- ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
- : (t) 0))
-#endif
-#ifndef TYPE_MAXIMUM
-# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
-#endif
+#include <verify.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -119,6 +100,22 @@
# define S_IWUSR 0200
#endif
+/* For systems that distinguish between text and binary I/O.
+ O_BINARY is usually declared in fcntl.h */
+#if !defined O_BINARY && defined _O_BINARY
+ /* For MSC-compatible compilers. */
+# define O_BINARY _O_BINARY
+#endif
+
+#ifdef __BEOS__
+ /* BeOS 5 has O_BINARY, but it has no effect. */
+# undef O_BINARY
+#endif
+
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
@@ -240,6 +237,8 @@ int strcasecmp (char const *, char const *);
# define vfork fork
#endif
+#include <intprops.h>
+
/* Type used for fast comparison of several bytes at a time. */
#ifndef word
@@ -251,9 +250,9 @@ int strcasecmp (char const *, char const *);
typedef ptrdiff_t lin;
#define LIN_MAX PTRDIFF_MAX
-verify (lin_is_signed, TYPE_SIGNED (lin));
-verify (lin_is_wide_enough, sizeof (ptrdiff_t) <= sizeof (lin));
-verify (lin_is_printable_as_long_int, sizeof (lin) <= sizeof (long int));
+verify (TYPE_SIGNED (lin));
+verify (sizeof (ptrdiff_t) <= sizeof (lin));
+verify (sizeof (lin) <= sizeof (long int));
/* This section contains POSIX-compliant defaults for macros
that are meant to be overridden by hand in config.h as needed. */