sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 84b08427a167f5729f7cd439a4eb260ece98e7b5
parent cca0522872c09f7caab26f0221286b0e6304b09f
Author: Evan Gates <evan.gates@gmail.com>
Date:   Tue, 18 Nov 2014 12:49:30 -0800

remove agetline

Diffstat:
MMakefile | 1-
Mcut.c | 2+-
Mfold.c | 2+-
Mgrep.c | 2+-
Mhead.c | 2+-
Dlibutil/agetline.c | 13-------------
Mlibutil/crypt.c | 2+-
Mlibutil/getlines.c | 2+-
Mnl.c | 2+-
Mtail.c | 4++--
Mtext.h | 1-
Mtr.c | 2+-
Muniq.c | 2+-
Muudecode.c | 4++--
14 files changed, 13 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile @@ -27,7 +27,6 @@ LIBUTFSRC =\ LIBUTIL = libutil.a LIBUTILSRC =\ libutil/agetcwd.c\ - libutil/agetline.c\ libutil/apathmax.c\ libutil/concat.c\ libutil/cp.c\ diff --git a/cut.c b/cut.c @@ -121,7 +121,7 @@ cut(FILE *fp) ssize_t len; Range *r; - while ((len = agetline(&buf, &size, fp)) != -1) { + while ((len = getline(&buf, &size, fp)) != -1) { if (len && buf[len - 1] == '\n') buf[len - 1] = '\0'; if (mode == 'f' && !strchr(buf, delim)) { diff --git a/fold.c b/fold.c @@ -64,7 +64,7 @@ fold(FILE *fp, long width) char *buf = NULL; size_t size = 0; - while (agetline(&buf, &size, fp) != -1) + while (getline(&buf, &size, fp) != -1) foldline(buf, width); free(buf); } diff --git a/grep.c b/grep.c @@ -132,7 +132,7 @@ grep(FILE *fp, const char *str) struct pattern *pnode; int match = NoMatch; - for (n = 1; (len = agetline(&buf, &size, fp)) != -1; n++) { + for (n = 1; (len = getline(&buf, &size, fp)) != -1; n++) { /* Remove the trailing newline if one is present. */ if (len && buf[len - 1] == '\n') buf[len - 1] = '\0'; diff --git a/head.c b/head.c @@ -56,7 +56,7 @@ head(FILE *fp, const char *str, long n) ssize_t len; unsigned long i = 0; - while (i < n && ((len = agetline(&buf, &size, fp)) != -1)) { + while (i < n && ((len = getline(&buf, &size, fp)) != -1)) { fputs(buf, stdout); if (buf[len - 1] == '\n') i++; diff --git a/libutil/agetline.c b/libutil/agetline.c @@ -1,13 +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" - -ssize_t -agetline(char **p, size_t *size, FILE *fp) -{ - return getline(p, size, fp); -} diff --git a/libutil/crypt.c b/libutil/crypt.c @@ -51,7 +51,7 @@ cryptcheck(char *sumfile, int argc, char *argv[], else if (!(cfp = fopen(sumfile, "r"))) eprintf("fopen %s:", sumfile); - while (agetline(&line, &bufsiz, cfp) != -1) { + while (getline(&line, &bufsiz, cfp) != -1) { if (!(file = strstr(line, " "))) { formatsucks++; continue; diff --git a/libutil/getlines.c b/libutil/getlines.c @@ -13,7 +13,7 @@ getlines(FILE *fp, struct linebuf *b) size_t size = 0, linelen; ssize_t len; - while ((len = agetline(&line, &size, fp)) != -1) { + while ((len = getline(&line, &size, fp)) != -1) { if (++b->nlines > b->capacity) { b->capacity += 512; nline = erealloc(b->lines, b->capacity * sizeof(*b->lines)); diff --git a/nl.c b/nl.c @@ -69,7 +69,7 @@ nl(FILE *fp) long n = 0; size_t size = 0; - while (agetline(&buf, &size, fp) != -1) { + while (getline(&buf, &size, fp) != -1) { if ((mode == 'a') || (mode == 'p' && !regexec(&preg, buf, 0, NULL, 0)) diff --git a/tail.c b/tail.c @@ -61,7 +61,7 @@ dropinit(FILE *fp, const char *str, long n) ssize_t len; unsigned long i = 0; - while (i < n && ((len = agetline(&buf, &size, fp)) != -1)) + while (i < n && ((len = getline(&buf, &size, fp)) != -1)) if (len && buf[len - 1] == '\n') i++; free(buf); @@ -78,7 +78,7 @@ taketail(FILE *fp, const char *str, long n) ring = ecalloc(n, sizeof *ring); size = ecalloc(n, sizeof *size); - for (i = j = 0; agetline(&ring[i], &size[i], fp) != -1; i = j = (i + 1) % n) + for (i = j = 0; getline(&ring[i], &size[i], fp) != -1; i = j = (i + 1) % n) ; if (ferror(fp)) eprintf("%s: read error:", str); diff --git a/text.h b/text.h @@ -8,5 +8,4 @@ struct linebuf { #define EMPTY_LINEBUF {NULL, 0, 0,} void getlines(FILE *, struct linebuf *); -ssize_t agetline(char **, size_t *, FILE *); void concat(FILE *, const char *, FILE *, const char *); diff --git a/tr.c b/tr.c @@ -346,7 +346,7 @@ main(int argc, char *argv[]) usage(); } - while ((nbytes = agetline(&buf, &size, stdin)) != -1) + while ((nbytes = getline(&buf, &size, stdin)) != -1) mapfunc(buf, nbytes); free(buf); if (ferror(stdin)) diff --git a/uniq.c b/uniq.c @@ -92,7 +92,7 @@ uniq(FILE *fp, const char *str) char *buf = NULL; size_t size = 0; - while (agetline(&buf, &size, fp) != -1) + while (getline(&buf, &size, fp) != -1) uniqline(buf); } diff --git a/uudecode.c b/uudecode.c @@ -128,7 +128,7 @@ uudecode(FILE *fp, FILE *outfp) #define IS_DEC(c) ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) ) #define OUT_OF_RANGE(c) eprintf("character %c out of range: [%d-%d]", (c), 1 + ' ', 077 + ' ' + 1) - while ((len = agetline(&bufb, &n, fp)) != -1) { + while ((len = getline(&bufb, &n, fp)) != -1) { p = bufb; /* trim newlines */ if (len && bufb[len - 1] != '\n') @@ -172,7 +172,7 @@ uudecode(FILE *fp, FILE *outfp) eprintf("read error:"); } /* check for end or fail */ - len = agetline(&bufb, &n, fp); + len = getline(&bufb, &n, fp); if (len < 3 || strncmp(bufb, "end", 3) != 0 || bufb[3] != '\n') eprintf("invalid uudecode footer \"end\" not found\n"); free(bufb);