diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-11-16 04:16:42 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-11-16 04:16:42 +0000 |
commit | 3243c629699c25f7f4a576fe1c2f58e274eba8f7 (patch) | |
tree | 13313bb150a27b55b2509040ec05f6786e7d8ba5 | |
parent | a85c45b1c774102095dfe0605bb6242bb7309462 (diff) |
Stop using <sys/param.h>; replace MAXPATHLEN with PATH_MAX, stop using MAX(),
and pull in <limits.h> for *_MAX constants.
inspired on a diff from Kamil Rytarowski (n54 (at) gmx.com)
ok bcallah@
-rw-r--r-- | usr.bin/mg/basic.c | 3 | ||||
-rw-r--r-- | usr.bin/mg/cscope.c | 3 | ||||
-rw-r--r-- | usr.bin/mg/dired.c | 5 | ||||
-rw-r--r-- | usr.bin/mg/echo.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/extend.c | 3 | ||||
-rw-r--r-- | usr.bin/mg/fileio.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/grep.c | 3 | ||||
-rw-r--r-- | usr.bin/mg/line.c | 3 | ||||
-rw-r--r-- | usr.bin/mg/main.c | 3 | ||||
-rw-r--r-- | usr.bin/mg/paragraph.c | 3 | ||||
-rw-r--r-- | usr.bin/mg/sysdef.h | 4 |
11 files changed, 23 insertions, 15 deletions
diff --git a/usr.bin/mg/basic.c b/usr.bin/mg/basic.c index 5d6f093cdb4..841f3215dc2 100644 --- a/usr.bin/mg/basic.c +++ b/usr.bin/mg/basic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: basic.c,v 1.42 2014/03/20 07:47:29 lum Exp $ */ +/* $OpenBSD: basic.c,v 1.43 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain */ @@ -14,6 +14,7 @@ #include "def.h" #include <ctype.h> +#include <limits.h> /* * Go to beginning of line. diff --git a/usr.bin/mg/cscope.c b/usr.bin/mg/cscope.c index a52a0a9e4f1..12ab06cad4f 100644 --- a/usr.bin/mg/cscope.c +++ b/usr.bin/mg/cscope.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cscope.c,v 1.7 2014/11/16 00:59:25 guenther Exp $ */ +/* $OpenBSD: cscope.c,v 1.8 2014/11/16 04:16:41 guenther Exp $ */ /* * This file is in the public domain. @@ -13,6 +13,7 @@ #include <ctype.h> #include <fcntl.h> #include <fnmatch.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c index 3e7576301c8..ce16df5e8ac 100644 --- a/usr.bin/mg/dired.c +++ b/usr.bin/mg/dired.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dired.c,v 1.67 2014/04/03 20:17:12 lum Exp $ */ +/* $OpenBSD: dired.c,v 1.68 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain. */ @@ -17,6 +17,7 @@ #include <sys/wait.h> #include <ctype.h> +#include <limits.h> #include <signal.h> #include <fcntl.h> #include <err.h> @@ -496,7 +497,7 @@ reaper(int signo __attribute__((unused))) int d_shell_command(int f, int n) { - char command[512], fname[MAXPATHLEN], *bufp; + char command[512], fname[PATH_MAX], *bufp; struct buffer *bp; struct mgwin *wp; char sname[NFILEN]; diff --git a/usr.bin/mg/echo.c b/usr.bin/mg/echo.c index 3fcedace735..7d6927dd3e7 100644 --- a/usr.bin/mg/echo.c +++ b/usr.bin/mg/echo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: echo.c,v 1.56 2014/03/20 07:47:29 lum Exp $ */ +/* $OpenBSD: echo.c,v 1.57 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain. */ @@ -711,7 +711,7 @@ complt_list(int flags, char *buf, int cpos) * Now do the display. Objects are written into linebuf until * it fills, and then put into the help buffer. */ - linesize = MAX(ncol, maxwidth) + 1; + linesize = (ncol > maxwidth ? ncol : maxwidth) + 1; if ((linebuf = malloc(linesize)) == NULL) { free_file_list(wholelist); return (FALSE); diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c index 7a4f0c6a49b..7a70e7f5a89 100644 --- a/usr.bin/mg/extend.c +++ b/usr.bin/mg/extend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: extend.c,v 1.56 2014/11/16 00:59:25 guenther Exp $ */ +/* $OpenBSD: extend.c,v 1.57 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain. */ @@ -12,6 +12,7 @@ #include <sys/types.h> #include <ctype.h> +#include <limits.h> #include "macro.h" diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c index 685066c2655..ec34bda55c5 100644 --- a/usr.bin/mg/fileio.c +++ b/usr.bin/mg/fileio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fileio.c,v 1.97 2014/03/20 07:47:29 lum Exp $ */ +/* $OpenBSD: fileio.c,v 1.98 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain. */ @@ -289,7 +289,7 @@ fbackupfile(const char *fn) char * adjustname(const char *fn, int slashslash) { - static char fnb[MAXPATHLEN]; + static char fnb[PATH_MAX]; const char *cp, *ep = NULL; char *path; diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c index fad1aba1fa9..0af9b6b0504 100644 --- a/usr.bin/mg/grep.c +++ b/usr.bin/mg/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.41 2014/11/16 00:59:25 guenther Exp $ */ +/* $OpenBSD: grep.c,v 1.42 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain */ @@ -9,6 +9,7 @@ #include <sys/types.h> #include <ctype.h> #include <libgen.h> +#include <limits.h> #include <time.h> int globalwd = FALSE; diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c index 51d17657d98..056073e2679 100644 --- a/usr.bin/mg/line.c +++ b/usr.bin/mg/line.c @@ -1,4 +1,4 @@ -/* $OpenBSD: line.c,v 1.53 2014/03/20 07:47:29 lum Exp $ */ +/* $OpenBSD: line.c,v 1.54 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain. */ @@ -19,6 +19,7 @@ #include "def.h" +#include <limits.h> #include <stdlib.h> #include <string.h> diff --git a/usr.bin/mg/main.c b/usr.bin/mg/main.c index 09dcd040e57..c6718ca71d9 100644 --- a/usr.bin/mg/main.c +++ b/usr.bin/mg/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.73 2014/11/13 21:36:23 florian Exp $ */ +/* $OpenBSD: main.c,v 1.74 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain. */ @@ -12,6 +12,7 @@ #include "macro.h" #include <err.h> +#include <limits.h> #include <locale.h> int thisflag; /* flags, this command */ diff --git a/usr.bin/mg/paragraph.c b/usr.bin/mg/paragraph.c index 58db0326c7f..7696277a835 100644 --- a/usr.bin/mg/paragraph.c +++ b/usr.bin/mg/paragraph.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paragraph.c,v 1.34 2014/10/17 13:25:13 lum Exp $ */ +/* $OpenBSD: paragraph.c,v 1.35 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain. */ @@ -8,6 +8,7 @@ */ #include <ctype.h> +#include <limits.h> #include "def.h" diff --git a/usr.bin/mg/sysdef.h b/usr.bin/mg/sysdef.h index 90787c708d6..6152e64c2b5 100644 --- a/usr.bin/mg/sysdef.h +++ b/usr.bin/mg/sysdef.h @@ -1,11 +1,11 @@ -/* $OpenBSD: sysdef.h,v 1.18 2014/11/16 01:01:28 guenther Exp $ */ +/* $OpenBSD: sysdef.h,v 1.19 2014/11/16 04:16:41 guenther Exp $ */ /* This file is in the public domain. */ /* * POSIX system header file */ -#include <sys/param.h> +#include <sys/types.h> #include <sys/queue.h> #include <stdio.h> #include <unistd.h> |