]> git.mdlowis.com Git - proto/pick.git/commitdiff
fixed warnings and updated build script to support custom flags
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 17 Apr 2019 20:40:01 +0000 (16:40 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 17 Apr 2019 20:40:01 +0000 (16:40 -0400)
build.sh
bytebuffer.inl
termbox.c

index 319adf259e494dfdb3d4f5ca8b6695dfc9ca8370..2bcd2c2d454c6badd608e521cefc68de2d6351fc 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -1,2 +1,4 @@
 #!/bin/sh
-gcc -D_XOPEN_SOURCE=700 *.c -I . -o pick -O3 -Wno-unused-result
+name=pick
+set -x
+gcc $CFLAGS -D_XOPEN_SOURCE=700 -I. -o $name *.c $LDFLAGS
index c476742de8ee93c193628d744e563b4530a09cb3..b24a67f36357476e16a7c3f0c6eba783934b96a0 100644 (file)
@@ -63,7 +63,7 @@ static void bytebuffer_resize(struct bytebuffer *b, int len) {
 }
 
 static void bytebuffer_flush(struct bytebuffer *b, int fd) {
-       write(fd, b->buf, b->len);
+       if (write(fd, b->buf, b->len) < 0) { /* oh well */ }
        bytebuffer_clear(b);
 }
 
index 71257f775211c361add04f9c5154f921e6e60fc6..a6b9366d63b5019698efec7d66f8c3909e624515 100644 (file)
--- a/termbox.c
+++ b/termbox.c
@@ -582,7 +582,7 @@ static void sigwinch_handler(int xxx)
 {
     (void) xxx;
     const int zzz = 1;
-    write(winch_fds[1], &zzz, sizeof(int));
+    if (write(winch_fds[1], &zzz, sizeof(int)) < 0) { /* oh well */ }
 }
 
 static void update_size(void)
@@ -672,7 +672,7 @@ static int wait_fill_event(struct tb_event *event, struct timeval *timeout)
         if (FD_ISSET(winch_fds[0], &events)) {
             event->type = TB_EVENT_RESIZE;
             int zzz = 0;
-            read(winch_fds[0], &zzz, sizeof(int));
+            if (read(winch_fds[0], &zzz, sizeof(int)) < 0) { /* oh well */ }
             buffer_size_change_request = 1;
             get_term_size(&event->w, &event->h);
             return TB_EVENT_RESIZE;