package

simple and robust package manager
Log | Files | Refs | README

commit cb3cdaedd4c38a14dc712d5b75e0efd2c380842b
parent fe49d97332ac094b3815e16e2383f6a7fe8c9c41
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu,  3 Jan 2019 01:02:59 +0100

needs not openreadclose

Diffstat:
MMakefile | 5++---
Dopenreadclose.c | 29-----------------------------
Dopenreadclose.h | 8--------
3 files changed, 2 insertions(+), 40 deletions(-)

diff --git a/Makefile b/Makefile @@ -5,11 +5,11 @@ all: pack-build pack-dep clean: rm -f *.o leapsecs leapsecs.dat -pack-build-o = pack-build.o pack.o buffer.o fmt.o fs.o log.o mem.o openreadclose.o str.o stralloc.o +pack-build-o = pack-build.o pack.o buffer.o fmt.o fs.o log.o mem.o str.o stralloc.o pack-build: ${pack-build-o} ./make-bin $@ ${pack-build-o} -pack-dep-o = pack-dep.o pack.o buffer.o fmt.o fs.o log.o mem.o openreadclose.o str.o stralloc.o +pack-dep-o = pack-dep.o pack.o buffer.o fmt.o fs.o log.o mem.o str.o stralloc.o pack-dep: ${pack-dep-o} ./make-bin $@ ${pack-dep-o} @@ -21,7 +21,6 @@ fmt.o: fmt.c fmt.h str.h fs.o: fs.c fs.h mem.h open.h str.h stralloc.h log.o: log.c buffer.h log.h mem.o: mem.c mem.h -openreadclose.o: openreadclose.c stralloc.h open.h pack-build.o: pack-build.c env.h log.h pack.h str.h pack-dep.o: pack-dep.c env.h log.h pack.h str.h pack.o: pack.c buffer.h fs.h mem.h open.h pack.h stralloc.h diff --git a/openreadclose.c b/openreadclose.c @@ -1,29 +0,0 @@ -#include <errno.h> -#include <unistd.h> -#include "stralloc.h" -#include "open.h" - -int -openreadclose(char const *path, stralloc *sa, size_t bufsize) -{ - ssize_t r; - int fd; - - fd = open_read(path); if (fd == -1) return 0; - - do { - if (!stralloc_readyplus(sa, bufsize)) { close(fd); return 0; } - r = read(fd, sa->x + sa->n, bufsize); - if (r == -1) { - if (errno == EINTR) continue; - if (errno == EAGAIN) continue; - if (errno == EWOULDBLOCK) continue; - close(fd); - return 0; - } - sa->n += r; - } while (r != 0); - - close(fd); - return 0; -} diff --git a/openreadclose.h b/openreadclose.h @@ -1,8 +0,0 @@ -#ifndef OPENREADCLOSE_H -#define OPENREADCLOSE_H - -#include "stralloc.h" - -int openreadclose(char const *, stralloc *, size_t); - -#endif