summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-01-22 11:06:01 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2015-01-22 11:06:01 +0100
commit742732a1c818e382bfd55e274b490e8b3cdf4dca (patch)
treec5ac90e182d664249782f9022e0b24a2e2c2629b
parent089ec389dd7de47295c0664d3f4193b1a66dbe4f (diff)
parent7936b9b2a7c7c3cc06d3fb60c22ed535b610cd63 (diff)
downloadcwm-742732a1c818e382bfd55e274b490e8b3cdf4dca.tar.gz
cwm-742732a1c818e382bfd55e274b490e8b3cdf4dca.tar.xz
cwm-742732a1c818e382bfd55e274b490e8b3cdf4dca.zip
cvsimport
-rw-r--r--calmwm.c3
-rw-r--r--calmwm.h4
-rw-r--r--client.c3
-rw-r--r--conf.c3
-rw-r--r--group.c3
-rw-r--r--kbfunc.c9
-rw-r--r--menu.c3
-rw-r--r--mousefunc.c3
-rw-r--r--parse.y19
-rw-r--r--screen.c3
-rw-r--r--search.c5
-rw-r--r--util.c3
-rw-r--r--xevents.c3
-rw-r--r--xmalloc.c3
-rw-r--r--xutil.c3
15 files changed, 44 insertions, 26 deletions
diff --git a/calmwm.c b/calmwm.c
index afc5e18..9de4d43 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -18,13 +18,14 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 #include <sys/wait.h>
 
 #include <err.h>
 #include <errno.h>
 #include <getopt.h>
+#include <limits.h>
 #include <locale.h>
 #include <pwd.h>
 #include <signal.h>
diff --git a/calmwm.h b/calmwm.h
index 023c8f9..b56a9d7 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -279,7 +279,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);
 
@@ -311,7 +311,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 4697df5..d49dd34 100644
--- a/client.c
+++ b/client.c
@@ -18,12 +18,13 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <assert.h>
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/conf.c b/conf.c
index 94c1773..ad9f24c 100644
--- a/conf.c
+++ b/conf.c
@@ -18,12 +18,13 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 #include <sys/stat.h>
 
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/group.c b/group.c
index 93b253c..81fae63 100644
--- a/group.c
+++ b/group.c
@@ -19,12 +19,13 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <assert.h>
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/kbfunc.c b/kbfunc.c
index afb0314..8ad5b99 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -18,12 +18,13 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <dirent.h>
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <paths.h>
 #include <signal.h>
 #include <stdio.h>
@@ -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 0203b33..2faa734 100644
--- a/menu.c
+++ b/menu.c
@@ -19,12 +19,13 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <ctype.h>
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/mousefunc.c b/mousefunc.c
index 00348f3..0da19aa 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -19,11 +19,12 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/parse.y b/parse.y
index d8fb0b5..eb8ed64 100644
--- a/parse.y
+++ b/parse.y
@@ -21,7 +21,7 @@
 
 %{
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include <sys/queue.h>
 
 #include <ctype.h>
@@ -49,7 +49,9 @@ struct file	*pushfile(const char *);
 int		 popfile(void);
 int		 yyparse(void);
 int		 yylex(void);
-int		 yyerror(const char *, ...);
+int		 yyerror(const char *, ...)
+    __attribute__((__format__ (printf, 1, 2)))
+    __attribute__((__nonnull__ (1)));
 int		 kw_cmp(const void *, const void *);
 int		 lookup(char *);
 int		 lgetc(int);
@@ -119,21 +121,21 @@ main		: FONTNAME STRING		{
 		}
 		| BORDERWIDTH NUMBER {
 			if ($2 < 0 || $2 > UINT_MAX) {
-				yyerror("invalid borderwidth: %d", $2);
+				yyerror("invalid borderwidth: %lld", $2);
 				YYERROR;
 			}
 			conf->bwidth = $2;
 		}
 		| MOVEAMOUNT NUMBER {
 			if ($2 < 0 || $2 > INT_MAX) {
-				yyerror("invalid movemount: %d", $2);
+				yyerror("invalid movemount: %lld", $2);
 				YYERROR;
 			}
 			conf->mamount = $2;
 		}
 		| SNAPDIST NUMBER {
 			if ($2 < 0 || $2 > INT_MAX) {
-				yyerror("invalid snapdist: %d", $2);
+				yyerror("invalid snapdist: %lld", $2);
 				YYERROR;
 			}
 			conf->snapdist = $2;
@@ -151,7 +153,7 @@ main		: FONTNAME STRING		{
 		| AUTOGROUP NUMBER STRING	{
 			if ($2 < 0 || $2 > 9) {
 				free($3);
-				yyerror("invalid autogroup: %d", $2);
+				yyerror("invalid autogroup: %lld", $2);
 				YYERROR;
 			}
 			conf_autogroup(conf, $2, $3);
@@ -176,7 +178,7 @@ main		: FONTNAME STRING		{
 			    $3 < 0 || $3 > INT_MAX ||
 			    $4 < 0 || $4 > INT_MAX ||
 			    $5 < 0 || $5 > INT_MAX) {
-				yyerror("invalid gap: %d %d %d %d",
+				yyerror("invalid gap: %lld %lld %lld %lld",
 				    $2, $3, $4, $5);
 				YYERROR;
 			}
@@ -438,6 +440,9 @@ yylex(void)
 			} else if (c == quotec) {
 				*p = '\0';
 				break;
+			} else if (c == '\0') {
+				yyerror("syntax error");
+				return (findeol());
 			}
 			if (p + 1 >= buf + sizeof(buf) - 1) {
 				yyerror("string too long");
diff --git a/screen.c b/screen.c
index f2b053e..e0aae1b 100644
--- a/screen.c
+++ b/screen.c
@@ -18,11 +18,12 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/search.c b/search.c
index 49e3184..33f2838 100644
--- a/search.c
+++ b/search.c
@@ -18,7 +18,7 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <assert.h>
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <fnmatch.h>
 #include <glob.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -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 c175165..3b28ba1 100644
--- a/util.c
+++ b/util.c
@@ -18,11 +18,12 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/xevents.c b/xevents.c
index 8facee1..df98b2d 100644
--- a/xevents.c
+++ b/xevents.c
@@ -24,11 +24,12 @@
  *   management of the xevent's.
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/xmalloc.c b/xmalloc.c
index cb24c26..059d7b3 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -18,11 +18,12 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdarg.h>
 #include <stdint.h>
 #include <stdio.h>
diff --git a/xutil.c b/xutil.c
index 460f902..71547a0 100644
--- a/xutil.c
+++ b/xutil.c
@@ -18,11 +18,12 @@
  * $OpenBSD$
  */
 
-#include <sys/param.h>
+#include <sys/types.h>
 #include "queue.h"
 
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>