summaryrefslogtreecommitdiffstats
path: root/glslview.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-02-04 20:00:02 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2016-02-04 20:00:02 +0100
commitd521cc0e83b279f4cd7a10a1704b8f36827a118d (patch)
tree8f80cfdc2da9753da5d2541eea587773390aa63a /glslview.c
parent05e2f21d27c4a8557e1afc61450414ec53cd48bb (diff)
downloadglslview-d521cc0e83b279f4cd7a10a1704b8f36827a118d.tar
glslview-d521cc0e83b279f4cd7a10a1704b8f36827a118d.zip
Remove unneeded headers from common.h, improve error handling
Diffstat (limited to 'glslview.c')
-rw-r--r--glslview.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/glslview.c b/glslview.c
index 05d0637..18cc512 100644
--- a/glslview.c
+++ b/glslview.c
@@ -25,14 +25,20 @@
#include "common.h"
-
+#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
+#include <GL/glew.h>
+
+#include <SDL2/SDL.h>
+#include <SDL2/SDL_opengl.h>
+
#ifdef USE_INOTIFY
# include <sys/inotify.h>
# include <sys/stat.h>
@@ -53,22 +59,20 @@ static int inotify_watch = -1;
static void reset_watch(void) {
if (inotify_watch >= 0) {
if (inotify_rm_watch(inotify_fd, inotify_watch)) {
- fprintf(stderr, "unable to remove watch\n");
+ fprintf(stderr, "unable to remove watch: %s\n", strerror(errno));
exit(1);
}
}
inotify_watch = inotify_add_watch(inotify_fd, filename, IN_CLOSE_WRITE);
- if (inotify_watch < 0) {
- fprintf(stderr, "unable to watch '%s' for changes\n", filename);
- return;
- }
+ if (inotify_watch < 0)
+ fprintf(stderr, "unable to watch '%s' for changes: %s\n", filename, strerror(errno));
}
static void init_watch(void) {
inotify_fd = inotify_init();
if (inotify_fd < 0) {
- fprintf(stderr, "unable to initialize inotify\n");
+ fprintf(stderr, "unable to initialize inotify: %s\n", strerror(errno));
exit(1);
}