[hackers] [sbase] remove afgets || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sun, 01 Jun 2014 19:03:24 +0200

commit 2ab2d2ee3b4c67dec4de2c0d436ab40d80f4624e
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sun Jun 1 15:12:33 2014 +0200

    remove afgets
    
    Signed-off-by: Hiltjo Posthuma <hiltjo_AT_codemadness.org>

diff --git a/Makefile b/Makefile
index abfceab..27a6693 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -5,7 +5,6 @@ include config.mk
 
 HDR = crypt.h fs.h text.h md5.h sha1.h sha256.h sha512.h util.h arg.h
 LIB = \
- util/afgets.o \
         util/agetcwd.o \
         util/agetline.o \
         util/apathmax.o \
diff --git a/text.h b/text.h
index afcfbe7..f2e582e 100644
--- a/text.h
+++ b/text.h
_AT_@ -8,6 +8,5 @@ struct linebuf {
 #define EMPTY_LINEBUF {NULL, 0, 0,}
 void getlines(FILE *, struct linebuf *);
 
-char *afgets(char **, size_t *, FILE *);
 ssize_t agetline(char **, size_t *, FILE *);
 void concat(FILE *, const char *, FILE *, const char *);
diff --git a/util/afgets.c b/util/afgets.c
deleted file mode 100644
index 4b4ffe2..0000000
--- a/util/afgets.c
+++ /dev/null
_AT_@ -1,28 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../text.h"
-#include "../util.h"
-
-char *
-afgets(char **p, size_t *size, FILE *fp)
-{
- char buf[BUFSIZ];
- size_t n, len = 0;
-
- while(fgets(buf, sizeof buf, fp)) {
- len += (n = strlen(buf));
- if(len+1 > *size && !(*p = realloc(*p, len+1)))
- eprintf("realloc:");
-
- memcpy(&(*p)[len-n], buf, n);
- (*p)[len] = '
Received on Sun Jun 01 2014 - 19:03:24 CEST

This archive was generated by hypermail 2.3.0 : Sun Jun 01 2014 - 19:12:16 CEST