diff options
author | bapt <bapt@FreeBSD.org> | 2016-05-10 11:11:23 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2016-05-10 11:11:23 +0000 |
commit | 9af4744a94145acbc3cbf6897ed72229f2941569 (patch) | |
tree | 2b1c7ed92eaf14e09f082db3b5ce30b7b4af6c2e /usr.bin/csplit | |
parent | a1263689538eb95c37d276455022a70c8d8ba5a2 (diff) | |
download | FreeBSD-src-9af4744a94145acbc3cbf6897ed72229f2941569.zip FreeBSD-src-9af4744a94145acbc3cbf6897ed72229f2941569.tar.gz |
Rename getline with get_line to avoid collision with getline(3)
When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added.
This rename is made in preparation for the removal of this guard
Obtained from: NetBSD
Diffstat (limited to 'usr.bin/csplit')
-rw-r--r-- | usr.bin/csplit/csplit.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/csplit/csplit.c b/usr.bin/csplit/csplit.c index 7143d73..a5e819f 100644 --- a/usr.bin/csplit/csplit.c +++ b/usr.bin/csplit/csplit.c @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); static void cleanup(void); static void do_lineno(const char *); static void do_rexp(const char *); -static char *getline(void); +static char *get_line(void); static void handlesig(int); static FILE *newfile(void); static void toomuch(FILE *, long); @@ -195,7 +195,7 @@ main(int argc, char *argv[]) /* Copy the rest into a new file. */ if (!feof(infile)) { ofp = newfile(); - while ((p = getline()) != NULL && fputs(p, ofp) == 0) + while ((p = get_line()) != NULL && fputs(p, ofp) == 0) ; if (!sflag) printf("%jd\n", (intmax_t)ftello(ofp)); @@ -270,7 +270,7 @@ cleanup(void) /* Read a line from the input into a static buffer. */ static char * -getline(void) +get_line(void) { static char lbuf[LINE_MAX]; FILE *src; @@ -291,7 +291,7 @@ again: if (fgets(lbuf, sizeof(lbuf), src) == NULL) { return (lbuf); } -/* Conceptually rewind the input (as obtained by getline()) back `n' lines. */ +/* Conceptually rewind the input (as obtained by get_line()) back `n' lines. */ static void toomuch(FILE *ofp, long n) { @@ -343,7 +343,7 @@ toomuch(FILE *ofp, long n) err(1, "%s", currfile); /* - * getline() will read from here. Next call will truncate to + * get_line() will read from here. Next call will truncate to * truncofs in this file. */ overfile = ofp; @@ -391,7 +391,7 @@ do_rexp(const char *expr) /* Read and output lines until we get a match. */ first = 1; - while ((p = getline()) != NULL) { + while ((p = get_line()) != NULL) { if (fputs(p, ofp) != 0) break; if (!first && regexec(&cre, p, 0, NULL, 0) == 0) @@ -417,7 +417,7 @@ do_rexp(const char *expr) * Positive offset: copy the requested number of lines * after the match. */ - while (--ofs > 0 && (p = getline()) != NULL) + while (--ofs > 0 && (p = get_line()) != NULL) fputs(p, ofp); toomuch(NULL, 0); nwritten = (intmax_t)ftello(ofp); @@ -451,7 +451,7 @@ do_lineno(const char *expr) while (nfiles < maxfiles - 1) { ofp = newfile(); while (lineno + 1 != lastline) { - if ((p = getline()) == NULL) + if ((p = get_line()) == NULL) errx(1, "%ld: out of range", lastline); if (fputs(p, ofp) != 0) break; |