diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-11-28 19:28:43 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-11-28 19:28:43 +0000 |
commit | 0a2b352b03317e999da1f6267e4f52c363714806 (patch) | |
tree | 4739c20bbb0e68615f4c3a44921e5c5a2755c787 /usr.bin/split | |
parent | 3401a7779d41e9ec5b75640de44fd2872b30d820 (diff) |
Stop using MAXBSIZE to eliminate sys/param.h including (which injects a
ton of namespace intrusion). Create local sizes, and refactor some code
along the way.
ok millert
Diffstat (limited to 'usr.bin/split')
-rw-r--r-- | usr.bin/split/split.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c index 450752eb2eb..08fb8d74934 100644 --- a/usr.bin/split/split.c +++ b/usr.bin/split/split.c @@ -1,4 +1,4 @@ -/* $OpenBSD: split.c,v 1.22 2021/10/24 21:24:17 deraadt Exp $ */ +/* $OpenBSD: split.c,v 1.23 2021/11/28 19:28:42 deraadt Exp $ */ /* $NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $ */ /* @@ -30,7 +30,6 @@ * SUCH DAMAGE. */ -#include <sys/param.h> /* MAXBSIZE */ #include <sys/types.h> #include <ctype.h> @@ -43,13 +42,15 @@ #include <unistd.h> #include <regex.h> +#define _MAXBSIZE (64 * 1024) + #define DEFLINE 1000 /* Default num lines per file. */ ssize_t bytecnt; /* Byte count to split on. */ long numlines; /* Line count to split on. */ int file_open; /* If a file open. */ int ifd = -1, ofd = -1; /* Input/output file descriptors. */ -char bfr[MAXBSIZE]; /* I/O buffer. */ +char bfr[_MAXBSIZE]; /* I/O buffer. */ char fname[PATH_MAX]; /* File name prefix. */ regex_t rgx; int pflag; @@ -176,7 +177,7 @@ split1(void) char *C; for (bcnt = 0;;) - switch ((len = read(ifd, bfr, MAXBSIZE))) { + switch ((len = read(ifd, bfr, sizeof(bfr)))) { case 0: exit(0); case -1: |