summaryrefslogtreecommitdiff
path: root/usr.bin/hexdump/hexdump.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
commit315054f4737a39489e0a14f3a92bff61f1592832 (patch)
tree62bf010653374ce09b6beb4dfa0414a91457233b /usr.bin/hexdump/hexdump.c
parent79e3d817585ca08a91e30ad14abe43e2ab70295f (diff)
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.bin/hexdump/hexdump.c')
-rw-r--r--usr.bin/hexdump/hexdump.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/hexdump/hexdump.c b/usr.bin/hexdump/hexdump.c
index 17dd5975f9c..a84a8c315bd 100644
--- a/usr.bin/hexdump/hexdump.c
+++ b/usr.bin/hexdump/hexdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hexdump.c,v 1.16 2011/09/22 09:09:42 stsp Exp $ */
+/* $OpenBSD: hexdump.c,v 1.17 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: hexdump.c,v 1.7 1997/10/19 02:34:06 lukem Exp $ */
/*
@@ -30,13 +30,14 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hexdump.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
FS *fshead; /* head of format strings */
int blocksize; /* data block size */
int exitval; /* final exit value */
@@ -64,7 +65,7 @@ main(int argc, char *argv[])
blocksize = tfs->bcnt;
}
if (length != -1) {
- iobufsiz = MIN(length, blocksize);
+ iobufsiz = MINIMUM(length, blocksize);
if ((iobuf = malloc(iobufsiz)) == NULL)
err(1, NULL);
}