summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
authorAlain Magloire <alainm@rcsm.ee.mcgill.ca>2000-01-17 00:55:06 +0000
committerAlain Magloire <alainm@rcsm.ee.mcgill.ca>2000-01-17 00:55:06 +0000
commitc5b5567e5d265cb8d7171e7d2add249bfefbf685 (patch)
tree24b7402a0dc2771b86cdfa9344f771da3ad4cf64 /src/system.h
parentb889cf3d9b14aafcc10f958b0e568334f7293991 (diff)
downloadgrep-c5b5567e5d265cb8d7171e7d2add249bfefbf685.tar.gz
ChangeLog NEWS THANKS doc/grep.1 doc/grep.texi src/grep.c
src/system.h Support for general option --binary-file from David O'Brien. Inititial patch from David O'Brien. Add --binary-files option. * NEWS, doc/grep.1, doc/grep.texi: Document it. * src/grep.c (BINARY_FILES_OPTION): New constant. (long_options, grep, usage, main): New --binary-files option. (binary_files): New var. * src/system.h (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, CHAR_MAX): New macros. (INT_MAX, UCHAR_MAX): Define in terms of TYPE_MAXIMUM.
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/system.h b/src/system.h
index a6966e47..3cd9b567 100644
--- a/src/system.h
+++ b/src/system.h
@@ -127,11 +127,20 @@ void free();
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
+/* The extra casts work around common compiler bugs. */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
+ ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
+ : (t) 0))
+#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
+#ifndef CHAR_MAX
+# define CHAR_MAX TYPE_MAXIMUM (char)
+#endif
#ifndef INT_MAX
-# define INT_MAX 2147483647
+# define INT_MAX TYPE_MAXIMUM (int)
#endif
#ifndef UCHAR_MAX
-# define UCHAR_MAX 255
+# define UCHAR_MAX TYPE_MAXIMUM (unsigned char)
#endif
#if !defined(STDC_HEADERS) && defined(HAVE_STRING_H) && defined(HAVE_MEMORY_H)