* [PATCH 1/3] getline.3: !*lineptr is sufficient
@ 2021-06-12 8:27 Alejandro Colomar
2021-06-12 8:27 ` [PATCH 2/3] ferror.3: tfix Alejandro Colomar
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Alejandro Colomar @ 2021-06-12 8:27 UTC (permalink / raw)
To: mtk.manpages; +Cc: наб, linux-man, Alejandro Colomar
From: наб <nabijaczleweli@nabijaczleweli.xyz>
No implementation or spec requires *n to be 0 to allocate a new buffer:
* musl checks for !*lineptr
(and sets *n=0 for later allocations)
* glibc checks for !*lineptr || !*n
(but only because it allocates early)
* NetBSD checks for !*lineptr
(and sets *n=0 for later allocations)
(but specifies *n => mlen(*lineptr) >= *n as a precondition,
to which this appears to be an exception)
* FreeBSD checks for !*lineptr and sets *n=0
(and specifies !*lineptr as sufficient)
* Lastly, POSIX.1-2017 specifies:
> If *n is non-zero, the application shall ensure that *lineptr
> either points to an object of size at least *n bytes,
> or is a null pointer.
The new wording matches POSIX, even if it arrives at the point slightly
differently
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
man3/getline.3 | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/man3/getline.3 b/man3/getline.3
index a32d7e770..6641ecc35 100644
--- a/man3/getline.3
+++ b/man3/getline.3
@@ -59,9 +59,7 @@ one was found.
.PP
If
.I "*lineptr"
-is set to NULL and
-.I *n
-is set 0 before the call, then
+is set to NULL before the call, then
.BR getline ()
will allocate a buffer for storing the line.
This buffer should be freed by the user program
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] ferror.3: tfix
2021-06-12 8:27 [PATCH 1/3] getline.3: !*lineptr is sufficient Alejandro Colomar
@ 2021-06-12 8:27 ` Alejandro Colomar
2021-06-20 3:50 ` Michael Kerrisk (man-pages)
2021-06-12 8:27 ` [PATCH 3/3] strcmp.3: tfix Alejandro Colomar
2021-06-20 3:50 ` [PATCH 1/3] getline.3: !*lineptr is sufficient Michael Kerrisk (man-pages)
2 siblings, 1 reply; 6+ messages in thread
From: Alejandro Colomar @ 2021-06-12 8:27 UTC (permalink / raw)
To: mtk.manpages; +Cc: thomasavoss, linux-man, Alejandro Colomar
From: thomasavoss <thomasavoss@protonmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
man3/ferror.3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man3/ferror.3 b/man3/ferror.3
index 41fd9a3b0..cb63e24fc 100644
--- a/man3/ferror.3
+++ b/man3/ferror.3
@@ -85,7 +85,7 @@ function returns nonzero if the end-of-file indicator is set for
otherwise, it returns zero.
.PP
The
-.BR feof ()
+.BR ferror ()
function returns nonzero if the error indicator is set for
.IR stream ;
otherwise, it returns zero.
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] strcmp.3: tfix
2021-06-12 8:27 [PATCH 1/3] getline.3: !*lineptr is sufficient Alejandro Colomar
2021-06-12 8:27 ` [PATCH 2/3] ferror.3: tfix Alejandro Colomar
@ 2021-06-12 8:27 ` Alejandro Colomar
2021-06-20 3:51 ` Michael Kerrisk (man-pages)
2021-06-20 3:50 ` [PATCH 1/3] getline.3: !*lineptr is sufficient Michael Kerrisk (man-pages)
2 siblings, 1 reply; 6+ messages in thread
From: Alejandro Colomar @ 2021-06-12 8:27 UTC (permalink / raw)
To: mtk.manpages
Cc: Alejandro Colomar, linux-man, Štěpán Němec
With a simple backslash, '\0' ended up as ' ' in the man output.
Reported-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
man3/strcmp.3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man3/strcmp.3 b/man3/strcmp.3
index c1992c184..3c5a5a6ad 100644
--- a/man3/strcmp.3
+++ b/man3/strcmp.3
@@ -143,7 +143,7 @@ First, some examples using
.EX
$ \fB./string_comp ABC ABC\fP
<str1> and <str2> are equal
-$ \fB./string_comp ABC AB\fP # \(aqC\(aq is ASCII 67; \(aqC\(aq \- \(aq\0\(aq = 67
+$ \fB./string_comp ABC AB\fP # \(aqC\(aq is ASCII 67; \(aqC\(aq \- \(aq\e0\(aq = 67
<str1> is greater than <str2> (67)
$ \fB./string_comp ABA ABZ\fP # \(aqA\(aq is ASCII 65; \(aqZ\(aq is ASCII 90
<str1> is less than <str2> (\-25)
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] getline.3: !*lineptr is sufficient
2021-06-12 8:27 [PATCH 1/3] getline.3: !*lineptr is sufficient Alejandro Colomar
2021-06-12 8:27 ` [PATCH 2/3] ferror.3: tfix Alejandro Colomar
2021-06-12 8:27 ` [PATCH 3/3] strcmp.3: tfix Alejandro Colomar
@ 2021-06-20 3:50 ` Michael Kerrisk (man-pages)
2 siblings, 0 replies; 6+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-06-20 3:50 UTC (permalink / raw)
To: Alejandro Colomar; +Cc: mtk.manpages, наб, linux-man
Hello Alex and Ahelenia,
On 6/12/21 8:27 PM, Alejandro Colomar wrote:
> From: наб <nabijaczleweli@nabijaczleweli.xyz>
>
> No implementation or spec requires *n to be 0 to allocate a new buffer:
> * musl checks for !*lineptr
> (and sets *n=0 for later allocations)
> * glibc checks for !*lineptr || !*n
> (but only because it allocates early)
> * NetBSD checks for !*lineptr
> (and sets *n=0 for later allocations)
> (but specifies *n => mlen(*lineptr) >= *n as a precondition,
> to which this appears to be an exception)
> * FreeBSD checks for !*lineptr and sets *n=0
> (and specifies !*lineptr as sufficient)
> * Lastly, POSIX.1-2017 specifies:
> > If *n is non-zero, the application shall ensure that *lineptr
> > either points to an object of size at least *n bytes,
> > or is a null pointer.
>
> The new wording matches POSIX, even if it arrives at the point slightly
> differently
>
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Thanks. Patch applied.
Cheers,
Michael
> ---
> man3/getline.3 | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/man3/getline.3 b/man3/getline.3
> index a32d7e770..6641ecc35 100644
> --- a/man3/getline.3
> +++ b/man3/getline.3
> @@ -59,9 +59,7 @@ one was found.
> .PP
> If
> .I "*lineptr"
> -is set to NULL and
> -.I *n
> -is set 0 before the call, then
> +is set to NULL before the call, then
> .BR getline ()
> will allocate a buffer for storing the line.
> This buffer should be freed by the user program
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] ferror.3: tfix
2021-06-12 8:27 ` [PATCH 2/3] ferror.3: tfix Alejandro Colomar
@ 2021-06-20 3:50 ` Michael Kerrisk (man-pages)
0 siblings, 0 replies; 6+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-06-20 3:50 UTC (permalink / raw)
To: Alejandro Colomar; +Cc: mtk.manpages, thomasavoss, linux-man
Hello Alex and Thomas,
On 6/12/21 8:27 PM, Alejandro Colomar wrote:
> From: thomasavoss <thomasavoss@protonmail.com>
>
> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Thanks. Patch applied.
Cheers,
Michael
> ---
> man3/ferror.3 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/man3/ferror.3 b/man3/ferror.3
> index 41fd9a3b0..cb63e24fc 100644
> --- a/man3/ferror.3
> +++ b/man3/ferror.3
> @@ -85,7 +85,7 @@ function returns nonzero if the end-of-file indicator is set for
> otherwise, it returns zero.
> .PP
> The
> -.BR feof ()
> +.BR ferror ()
> function returns nonzero if the error indicator is set for
> .IR stream ;
> otherwise, it returns zero.
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] strcmp.3: tfix
2021-06-12 8:27 ` [PATCH 3/3] strcmp.3: tfix Alejandro Colomar
@ 2021-06-20 3:51 ` Michael Kerrisk (man-pages)
0 siblings, 0 replies; 6+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-06-20 3:51 UTC (permalink / raw)
To: Alejandro Colomar
Cc: mtk.manpages, linux-man, Štěpán Němec
Hello Štěpán and Alex,
On 6/12/21 8:27 PM, Alejandro Colomar wrote:
> With a simple backslash, '\0' ended up as ' ' in the man output.
>
> Reported-by: Štěpán Němec <stepnem@gmail.com>
> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Thanks. Patch applied.
Cheers,
Michael
> ---
> man3/strcmp.3 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/man3/strcmp.3 b/man3/strcmp.3
> index c1992c184..3c5a5a6ad 100644
> --- a/man3/strcmp.3
> +++ b/man3/strcmp.3
> @@ -143,7 +143,7 @@ First, some examples using
> .EX
> $ \fB./string_comp ABC ABC\fP
> <str1> and <str2> are equal
> -$ \fB./string_comp ABC AB\fP # \(aqC\(aq is ASCII 67; \(aqC\(aq \- \(aq\0\(aq = 67
> +$ \fB./string_comp ABC AB\fP # \(aqC\(aq is ASCII 67; \(aqC\(aq \- \(aq\e0\(aq = 67
> <str1> is greater than <str2> (67)
> $ \fB./string_comp ABA ABZ\fP # \(aqA\(aq is ASCII 65; \(aqZ\(aq is ASCII 90
> <str1> is less than <str2> (\-25)
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-20 3:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-12 8:27 [PATCH 1/3] getline.3: !*lineptr is sufficient Alejandro Colomar
2021-06-12 8:27 ` [PATCH 2/3] ferror.3: tfix Alejandro Colomar
2021-06-20 3:50 ` Michael Kerrisk (man-pages)
2021-06-12 8:27 ` [PATCH 3/3] strcmp.3: tfix Alejandro Colomar
2021-06-20 3:51 ` Michael Kerrisk (man-pages)
2021-06-20 3:50 ` [PATCH 1/3] getline.3: !*lineptr is sufficient Michael Kerrisk (man-pages)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.