aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2004-08-14 20:48:09 +0000
committerDimitri Sokolyuk <demon@dim13.org>2004-08-14 20:48:09 +0000
commit9a5f29b25b9daa05d8eaaa15756273883d377331 (patch)
tree49d2ceaad308e5647e7e6abb5885382036a1a8a2
parentc2fca04f300128767fb0d44c99d89225fd0c230d (diff)
use _POSIX_MAX_INPUT for buffer size
-rw-r--r--watch.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/watch.c b/watch.c
index e8d9773..0a135ca 100644
--- a/watch.c
+++ b/watch.c
@@ -29,13 +29,11 @@
#include <signal.h>
#include <curses.h>
#include <errno.h>
+#include <limits.h>
#include <sys/ioctl.h>
#include <sys/time.h>
-#define MAXBUF 1024
-
-static char buffer[MAXBUF];
-
+static char buffer[_POSIX_MAX_INPUT];
static char *copyright = "(c) 2003, 2004 demon <demon@vhost.dyndns.org>";
static char *version = "0.5";
extern char *__progname;
@@ -120,14 +118,14 @@ readargs(char **argv)
return -1;
alen = strlen(*argv);
- if (alen + 1 >= MAXBUF)
+ if (alen + 1 >= _POSIX_MAX_INPUT)
return -1;
memcpy(buffer, *argv, alen);
while (*++argv != NULL) {
alen = strlen(*argv);
blen = strlen(buffer);
- if (alen + blen + 1 >= MAXBUF)
+ if (alen + blen + 1 >= _POSIX_MAX_INPUT)
return -1;
buffer[blen] = ' ';
memcpy(buffer + blen + 1, *argv, alen);
@@ -172,13 +170,13 @@ display()
int
title()
{
- char title[MAXBUF];
+ char title[_POSIX_MAX_INPUT];
int tlen, tlen2;
time_t tval = time(NULL);
struct tm *tm = localtime(&tval);
- if (cols + 1 >= MAXBUF)
+ if (cols + 1 >= _POSIX_MAX_INPUT)
return -1;
snprintf(title, cols, " Every %ds : %s", period, buffer);