On Mon, Jun 23, 2008 at 11:34 AM, Michael Kerrisk <[EMAIL PROTECTED]> wrote: > On Mon, Jun 23, 2008 at 11:33 AM, Stephane Chazelas > <[EMAIL PROTECTED]> wrote: >> On Mon, Jun 23, 2008 at 11:27:39AM +0200, Michael Kerrisk wrote: >> [...] >>> > Also, the %as GNU extension seems not to be documented >>> > (it may return ENOMEM) in the man page. It is in the glibc >>> > documentation. >>> >>> Have you tried using this? I'm trying to test now, but gcc complains >>> that '%a' expects type 'float *'. >> [...] >> >> ~$ cat a.c >> #include <stdio.h> >> >> int main(int argc, char **argv) >> { >> char *a; >> sscanf(argv[1], "%as", &a); >> puts(a); >> return 0; >> } >> ~$ cc -Wall -c a.c >> ~$ ./a "xx yy" >> xx >> ~$ gcc-2.95 -Wall -c a.c >> ~$ gcc-3.3 -Wall -c a.c >> ~$ gcc-3.4 -Wall -c a.c >> ~$ gcc-4.1 -Wall -c a.c >> ~$ gcc-4.2 -Wall -c a.c >> ~$ gcc-4.3 -Wall -c a.c >> ~$ >> >> Seems OK. >> >> Maybe you had "%a" instead of "%as"? > > No, my problem was that my cc alias includes ansi c 99, which disables > this scanf() feature...
Okay -- so %as is available by default, but disabled by -std=c99, unless _GNU_SOURCE is also specified :-} -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]