Sourceware Bugzilla – Attachment 7333 Details for
Bug 16376
[PATCH] manual: Document %m instead of %a for formatted input, note POSIX.1-2008
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
manual: Document %m instead of %a for formatted input, note POSIX.1-2008
0001-manual-Document-m-instead-of-a-for-formatted-input-n.patch (text/plain), 2.13 KB, created by
Ville Skyttä
on 2013-12-27 21:56:38 UTC
(
hide
)
Description:
manual: Document %m instead of %a for formatted input, note POSIX.1-2008
Filename:
MIME Type:
Creator:
Ville Skyttä
Created:
2013-12-27 21:56:38 UTC
Size:
2.13 KB
patch
obsolete
>From 8b242ad06dd516957a939c76474c433d666e3bd5 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi> >Date: Fri, 27 Dec 2013 23:41:34 +0200 >Subject: [PATCH] manual: Document %m instead of %a for formatted input, note > POSIX.1-2008. > >--- > manual/stdio.texi | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > >diff --git a/manual/stdio.texi b/manual/stdio.texi >index 7957a2a..78bea79 100644 >--- a/manual/stdio.texi >+++ b/manual/stdio.texi >@@ -3730,18 +3730,19 @@ input with a comprehensible error message, not with a crash. > @node Dynamic String Input > @subsection Dynamically Allocating String Conversions > >-A GNU extension to formatted input lets you safely read a string with no >-maximum size. Using this feature, you don't supply a buffer; instead, >-@code{scanf} allocates a buffer big enough to hold the data and gives >-you its address. To use this feature, write @samp{a} as a flag >-character, as in @samp{%as} or @samp{%a[0-9a-z]}. >+A GNU and POSIX.1-2008 extension to formatted input lets you safely >+read a string with no maximum size. Using this feature, you don't >+supply a buffer; instead, @code{scanf} allocates a buffer big enough >+to hold the data and gives you its address. To use this feature, >+write @samp{m} as a flag character, as in @samp{%ms} or >+@samp{%m[0-9a-z]}. > > The pointer argument you supply for where to store the input should have > type @code{char **}. The @code{scanf} function allocates a buffer and > stores its address in the word that the argument points to. You should > free the buffer with @code{free} when you no longer need it. > >-Here is an example of using the @samp{a} flag with the @samp{%[@dots{}]} >+Here is an example of using the @samp{m} flag with the @samp{%[@dots{}]} > conversion specification to read a ``variable assignment'' of the form > @samp{@var{variable} = @var{value}}. > >@@ -3749,7 +3750,7 @@ conversion specification to read a ``variable assignment'' of the form > @{ > char *variable, *value; > >- if (2 > scanf ("%a[a-zA-Z0-9] = %a[^\n]\n", >+ if (2 > scanf ("%m[a-zA-Z0-9] = %m[^\n]\n", > &variable, &value)) > @{ > invalid_input_error (); >-- >1.8.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 16376
: 7333