Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9ef2706a
Commit
9ef2706a
authored
Mar 10, 2005
by
C. Scott Ananian
Committed by
Alexandre Julliard
Mar 10, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow scanf to continue parsing format string after a '%n'.
parent
5f033b88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
scanf.h
dlls/msvcrt/scanf.h
+13
-0
scanf.c
dlls/msvcrt/tests/scanf.c
+8
-0
No files found.
dlls/msvcrt/scanf.h
View file @
9ef2706a
...
...
@@ -427,6 +427,19 @@ _FUNCTION_ {
int
*
n
=
va_arg
(
ap
,
int
*
);
*
n
=
consumed
-
(
nch
!=
_EOF_
);
}
/* This is an odd one: according to the standard,
* "Execution of a %n directive does not increment the
* assignment count returned at the completion of
* execution" even if it wasn't suppressed with the
* '*' flag. The Corrigendum to the standard seems
* to contradict this (comment out the assignment to
* suppress below if you want to implement these
* alternate semantics) but the windows program I'm
* looking at expects the behavior I've coded here
* (which happens to be what glibc does as well).
*/
suppress
=
1
;
st
=
1
;
}
break
;
case
'['
:
{
...
...
dlls/msvcrt/tests/scanf.c
View file @
9ef2706a
...
...
@@ -117,6 +117,14 @@ static void test_sscanf( void )
ok
(
hour
==
18
,
"Field 1 incorrect: %d
\n
"
,
hour
);
ok
(
min
==
59
,
"Field 2 incorrect: %d
\n
"
,
min
);
ok
(
c
==
0x55
,
"Field 3 incorrect: 0x%02x
\n
"
,
c
);
/* Check %n (also whitespace in format strings and %s) */
buffer
[
0
]
=
0
;
buffer1
[
0
]
=
0
;
ret
=
sscanf
(
"abc def"
,
"%s %n%s"
,
buffer
,
&
number_so_far
,
buffer1
);
ok
(
strcmp
(
buffer
,
"abc"
)
==
0
,
"First %%s read incorrectly: %s
\n
"
,
buffer
);
ok
(
strcmp
(
buffer1
,
"def"
)
==
0
,
"Second %%s read incorrectly: %s
\n
"
,
buffer1
);
ok
(
number_so_far
==
6
,
"%%n yielded wrong result: %d
\n
"
,
number_so_far
);
ok
(
ret
==
2
,
"%%n shouldn't count as a conversion: %d
\n
"
,
ret
);
}
START_TEST
(
scanf
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment