diff options
| author | Alejandro Colomar <alx@kernel.org> | 2024-11-17 18:47:53 +0100 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2024-11-17 21:51:23 +0100 |
| commit | 18e7c4597c4e72fa5210c7887273e363c456c9ee (patch) | |
| tree | 97cfd22e731a4c859ae71783d70943ff72e6cb60 /man/man2/tee.2 | |
| parent | 8fc6fdd8291d906e58a175b5e1b20da680aaeb4a (diff) | |
| download | man-pages-18e7c4597c4e.tar.gz | |
man/: Terminology consistency reforms (n, size, length)
Use 'length' for the lenght of a string.
Use 'n' for the number of elements.
Use 'size' for the number of bytes. (And in wide-character string
functions, 'size' also refers to the number of wide characters.)
The change is quite large, and I might have made some mistakes.
But overall, this should improve consistency in use of these terms.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man/man2/tee.2')
| -rw-r--r-- | man/man2/tee.2 | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/man/man2/tee.2 b/man/man2/tee.2 index 0b91b2b5b2..33b2b8b684 100644 --- a/man/man2/tee.2 +++ b/man/man2/tee.2 @@ -14,7 +14,7 @@ Standard C library .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" .B #include <fcntl.h> .P -.BI "ssize_t tee(int " fd_in ", int " fd_out ", size_t " len \ +.BI "ssize_t tee(int " fd_in ", int " fd_out ", size_t " size \ ", unsigned int " flags ); .fi .\" Return type was long before glibc 2.7 @@ -27,7 +27,7 @@ Standard C library .\" one pipe to two other pipes. .BR tee () duplicates up to -.I len +.I size bytes of data from the pipe referred to by the file descriptor .I fd_in to the pipe referred to by the file descriptor @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) { int fd; - ssize_t len, slen; + ssize_t size, ssize; \& if (argc != 2) { fprintf(stderr, "Usage: %s <file>\[rs]n", argv[0]); @@ -164,28 +164,28 @@ main(int argc, char *argv[]) /* * tee stdin to stdout. */ - len = tee(STDIN_FILENO, STDOUT_FILENO, + size = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); - if (len < 0) { + if (size < 0) { if (errno == EAGAIN) continue; perror("tee"); exit(EXIT_FAILURE); } - if (len == 0) + if (size == 0) break; \& /* * Consume stdin by splicing it to a file. */ - while (len > 0) { - slen = splice(STDIN_FILENO, NULL, fd, NULL, - len, SPLICE_F_MOVE); - if (slen < 0) { + while (size > 0) { + ssize = splice(STDIN_FILENO, NULL, fd, NULL, + size, SPLICE_F_MOVE); + if (ssize < 0) { perror("splice"); exit(EXIT_FAILURE); } - len \-= slen; + size \-= ssize; } } \& |
