gif

read/write GIFs
git clone git://bvnf.space/gm.git
Log | Files | Refs | README

commit 7cc60d17c3dbfbf4c73c2b60a073162d363d8857
parent 3169705275b7666e266acd81b53dd76d7d93fa4b
Author: phoebos <ben@bvnf.space>
Date:   Tue, 24 Aug 2021 21:33:35 +0100

s/^I/    /g

Diffstat:
Mgif.c | 42+++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/gif.c b/gif.c @@ -19,27 +19,27 @@ main(int argc, char **argv){ int fd; ++argv; do { - fd = 0; - if (*argv && **argv != '-') { - fd = open(*argv, O_RDONLY); - if (fd == -1) { - perror("open"); - return FAIL_SYS; - } - } - char buf[BUF_SIZE]; - fprintf(stderr, "reading from %s\n", *argv); - ssize_t bytes = read(fd, buf, BUF_SIZE); - if (bytes < 0) { - perror("read"); - return FAIL_SYS; - } - if (close(fd) != 0) { - perror("close"); - return FAIL_SYS; - } - buf[bytes] = '\0'; - printf("%s\n", buf); + fd = 0; + if (*argv && **argv != '-') { + fd = open(*argv, O_RDONLY); + if (fd == -1) { + perror("open"); + return FAIL_SYS; + } + } + char buf[BUF_SIZE]; + fprintf(stderr, "reading from %s\n", *argv); + ssize_t bytes = read(fd, buf, BUF_SIZE); + if (bytes < 0) { + perror("read"); + return FAIL_SYS; + } + if (close(fd) != 0) { + perror("close"); + return FAIL_SYS; + } + buf[bytes] = '\0'; + printf("%s\n", buf); } while (*++argv); return 0; }