From 69c7524909cec83591a6cea56722753922d9999a Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 19 Jan 2015 14:54:16 +0000 Subject: Switch to limits.h; replace MAXPATHLEN and MAXHOSTNAMELEN with PATH_MAX and HOST_NAME_MAX+1, respectively. ok doug@ --- calmwm.c | 5 +++-- calmwm.h | 6 +++--- client.c | 5 +++-- conf.c | 5 +++-- group.c | 5 +++-- kbfunc.c | 11 ++++++----- menu.c | 5 +++-- mousefunc.c | 5 +++-- parse.y | 4 ++-- screen.c | 5 +++-- search.c | 7 ++++--- util.c | 5 +++-- xevents.c | 5 +++-- xmalloc.c | 5 +++-- xutil.c | 5 +++-- 15 files changed, 48 insertions(+), 35 deletions(-) diff --git a/calmwm.c b/calmwm.c index a74a0fb..f0d009b 100644 --- a/calmwm.c +++ b/calmwm.c @@ -15,16 +15,17 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.c,v 1.92 2014/09/08 20:11:22 okan Exp $ + * $OpenBSD: calmwm.c,v 1.93 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include #include #include +#include #include #include #include diff --git a/calmwm.h b/calmwm.h index 67b336c..955d9fc 100644 --- a/calmwm.h +++ b/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.283 2014/10/08 12:48:51 okan Exp $ + * $OpenBSD: calmwm.h,v 1.284 2015/01/19 14:54:16 okan Exp $ */ #ifndef _CALMWM_H_ @@ -260,7 +260,7 @@ TAILQ_HEAD(mousebinding_q, binding); struct cmd { TAILQ_ENTRY(cmd) entry; char *name; - char path[MAXPATHLEN]; + char path[PATH_MAX]; }; TAILQ_HEAD(cmd_q, cmd); @@ -292,7 +292,7 @@ struct conf { int snapdist; struct gap gap; char *color[CWM_COLOR_NITEMS]; - char known_hosts[MAXPATHLEN]; + char known_hosts[PATH_MAX]; #define CONF_FONT "sans-serif:pixelsize=14:bold" char *font; Cursor cursor[CF_NITEMS]; diff --git a/client.c b/client.c index c2cddb4..1dc61f8 100644 --- a/client.c +++ b/client.c @@ -15,15 +15,16 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.188 2014/09/27 19:04:32 okan Exp $ + * $OpenBSD: client.c,v 1.189 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include #include +#include #include #include #include diff --git a/conf.c b/conf.c index 3615701..2439659 100644 --- a/conf.c +++ b/conf.c @@ -15,15 +15,16 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: conf.c,v 1.181 2014/09/17 18:41:44 okan Exp $ + * $OpenBSD: conf.c,v 1.182 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include #include +#include #include #include #include diff --git a/group.c b/group.c index 87c307d..a5f4859 100644 --- a/group.c +++ b/group.c @@ -16,15 +16,16 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.109 2014/10/08 12:48:51 okan Exp $ + * $OpenBSD: group.c,v 1.110 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include #include +#include #include #include #include diff --git a/kbfunc.c b/kbfunc.c index d5afd1f..e6798f9 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -15,15 +15,16 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.104 2014/09/27 19:04:32 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.105 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include #include +#include #include #include #include @@ -238,7 +239,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg) #define NPATHS 256 struct screen_ctx *sc = cc->sc; char **ap, *paths[NPATHS], *path, *pathcpy; - char tpath[MAXPATHLEN]; + char tpath[PATH_MAX]; const char *label; DIR *dirp; struct dirent *dp; @@ -323,8 +324,8 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) struct menu_q menuq; FILE *fp; char *buf, *lbuf, *p; - char hostbuf[MAXHOSTNAMELEN]; - char path[MAXPATHLEN]; + char hostbuf[HOST_NAME_MAX+1]; + char path[PATH_MAX]; int l; size_t len; diff --git a/menu.c b/menu.c index 450fa4d..6c04fd6 100644 --- a/menu.c +++ b/menu.c @@ -16,15 +16,16 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: menu.c,v 1.77 2014/09/07 19:27:30 okan Exp $ + * $OpenBSD: menu.c,v 1.78 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include #include +#include #include #include #include diff --git a/mousefunc.c b/mousefunc.c index 1edf5e5..443b888 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,14 +16,15 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.85 2014/09/27 19:04:32 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.86 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include +#include #include #include #include diff --git a/parse.y b/parse.y index 2ee5727..5aa07d0 100644 --- a/parse.y +++ b/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.60 2015/01/17 02:05:03 okan Exp $ */ +/* $OpenBSD: parse.y,v 1.61 2015/01/19 14:54:16 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -21,7 +21,7 @@ %{ -#include +#include #include #include diff --git a/screen.c b/screen.c index 4ca44a9..4e7c617 100644 --- a/screen.c +++ b/screen.c @@ -15,14 +15,15 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: screen.c,v 1.70 2014/10/08 15:31:01 okan Exp $ + * $OpenBSD: screen.c,v 1.71 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include +#include #include #include #include diff --git a/search.c b/search.c index 7e55a51..0acfd2c 100644 --- a/search.c +++ b/search.c @@ -15,10 +15,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: search.c,v 1.41 2014/09/15 13:00:49 okan Exp $ + * $OpenBSD: search.c,v 1.42 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -172,7 +173,7 @@ search_print_client(struct menu *mi, int list) static void search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, int flag) { - char pattern[MAXPATHLEN]; + char pattern[PATH_MAX]; glob_t g; int i; diff --git a/util.c b/util.c index 8220d2f..9480448 100644 --- a/util.c +++ b/util.c @@ -15,14 +15,15 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: util.c,v 1.16 2012/11/09 03:52:02 okan Exp $ + * $OpenBSD: util.c,v 1.17 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include +#include #include #include #include diff --git a/xevents.c b/xevents.c index 1f297a5..b158288 100644 --- a/xevents.c +++ b/xevents.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xevents.c,v 1.115 2014/09/27 19:04:32 okan Exp $ + * $OpenBSD: xevents.c,v 1.116 2015/01/19 14:54:16 okan Exp $ */ /* @@ -24,11 +24,12 @@ * management of the xevent's. */ -#include +#include #include #include #include +#include #include #include #include diff --git a/xmalloc.c b/xmalloc.c index 2aa666b..94f0691 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -15,14 +15,15 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xmalloc.c,v 1.13 2014/09/07 19:27:30 okan Exp $ + * $OpenBSD: xmalloc.c,v 1.14 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include +#include #include #include #include diff --git a/xutil.c b/xutil.c index 26188af..8cd5d07 100644 --- a/xutil.c +++ b/xutil.c @@ -15,14 +15,15 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xutil.c,v 1.96 2014/09/23 14:25:08 okan Exp $ + * $OpenBSD: xutil.c,v 1.97 2015/01/19 14:54:16 okan Exp $ */ -#include +#include #include #include #include +#include #include #include #include -- cgit v1.2.3-2-gb3c3