All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scanf.3: clarify that %n supports type modifiers
@ 2021-03-28 21:55 Alyssa Ross
  2021-03-30  9:15 ` Alejandro Colomar (man-pages)
  0 siblings, 1 reply; 2+ messages in thread
From: Alyssa Ross @ 2021-03-28 21:55 UTC (permalink / raw)
  To: linux-man; +Cc: Alejandro Colomar, Michael Kerrisk

My initial reading of this was that type modifiers were probably not
supported.  But they are, and this is actually documented further up,
in the type modifiers documentation.  But to make it clearer, let's
copy the language that printf(3) has in its %n section.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
I plan to submit a similar clarification to the glibc documentation.

 man3/scanf.3 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/man3/scanf.3 b/man3/scanf.3
index f353f1d4d..8c0a1fa84 100644
--- a/man3/scanf.3
+++ b/man3/scanf.3
@@ -513,18 +513,20 @@ circumflex, in) set or when the field width runs out.
 .TP
 .B n
 Nothing is expected; instead, the number of characters consumed thus far
 from the input is stored through the next pointer, which must be a pointer
 to
-.IR int .
+.IR int ,
+or variant whose size matches the (optionally)
+supplied integer length modifier.
 This is
 .I not
 a conversion and does
 .I not
 increase the count returned by the function.
 The assignment can be suppressed with the
 .B *
 assignment-suppression character, but the effect on the
 return value is undefined.
 Therefore
 .B %*n
 conversions should not be used.
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scanf.3: clarify that %n supports type modifiers
  2021-03-28 21:55 [PATCH] scanf.3: clarify that %n supports type modifiers Alyssa Ross
@ 2021-03-30  9:15 ` Alejandro Colomar (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-03-30  9:15 UTC (permalink / raw)
  To: Alyssa Ross, linux-man; +Cc: Michael Kerrisk

Hello Alyssa,

On 3/28/21 11:55 PM, Alyssa Ross wrote:
> My initial reading of this was that type modifiers were probably not
> supported.  But they are, and this is actually documented further up,
> in the type modifiers documentation.  But to make it clearer, let's
> copy the language that printf(3) has in its %n section.
> 
> Signed-off-by: Alyssa Ross <hi@alyssa.is>

Patch applied.

Thanks,

Alex

> ---
> I plan to submit a similar clarification to the glibc documentation.
> 
>   man3/scanf.3 | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/man3/scanf.3 b/man3/scanf.3
> index f353f1d4d..8c0a1fa84 100644
> --- a/man3/scanf.3
> +++ b/man3/scanf.3
> @@ -513,18 +513,20 @@ circumflex, in) set or when the field width runs out.
>   .TP
>   .B n
>   Nothing is expected; instead, the number of characters consumed thus far
>   from the input is stored through the next pointer, which must be a pointer
>   to
> -.IR int .
> +.IR int ,
> +or variant whose size matches the (optionally)
> +supplied integer length modifier.
>   This is
>   .I not
>   a conversion and does
>   .I not
>   increase the count returned by the function.
>   The assignment can be suppressed with the
>   .B *
>   assignment-suppression character, but the effect on the
>   return value is undefined.
>   Therefore
>   .B %*n
>   conversions should not be used.
> 


-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-30  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-28 21:55 [PATCH] scanf.3: clarify that %n supports type modifiers Alyssa Ross
2021-03-30  9:15 ` Alejandro Colomar (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.