aboutsummaryrefslogtreecommitdiff
path: root/watch.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-22 11:10:41 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-22 11:10:41 +0200
commit94f90dc4f48ee7f6bc1aa3a1116f20b714df89c9 (patch)
tree5ed69dfde863de16c6cf6a4ece0fabc7c831354e /watch.c
parenta3c687478843b98cf7cb06d465933064e2dbabe1 (diff)
downloadwhen-94f90dc4f48ee7f6bc1aa3a1116f20b714df89c9.tar.gz
Clean up code
Diffstat (limited to 'watch.c')
-rw-r--r--watch.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/watch.c b/watch.c
index 7e3d256..12cfbee 100644
--- a/watch.c
+++ b/watch.c
@@ -1,23 +1,21 @@
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <sys/event.h>
-#include <sys/resource.h>
-#include <sys/time.h>
-#include <sys/types.h>
#include <unistd.h>
#define FD 27
-#define LIMIT 100
+#define MAXFILES 100
+#define MAXFD 127 /* FD + MAXFILES */
int
-main(int argc, char *argv[argc]) {
- char *filenames[LIMIT+FD];
+main(int argc, char *argv[argc])
+{
+ char *filenames[MAXFD];
int fd, i, kq, n;
- struct kevent evs[LIMIT];
- struct kevent ev[LIMIT];
+ struct kevent evs[MAXFILES];
+ struct kevent ev[MAXFILES];
/* parse arguments */
if (argc-1 == 0) goto usage;
@@ -30,8 +28,8 @@ main(int argc, char *argv[argc]) {
argv++; argc--;
}
if (argc-1 == 0) goto usage;
- if (argc-1 > LIMIT)
- errx(1, "more than %d files", LIMIT);
+ if (argc-1 > MAXFILES)
+ errx(1, "more than %d files", MAXFILES);
/* disable buffering even non-interactively */
setbuf(stdout, NULL);