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
4d3952f3
Commit
4d3952f3
authored
Aug 08, 2006
by
Duane Clark
Committed by
Alexandre Julliard
Aug 09, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: In text mode a ctrl-z signals EOF.
Spotted by David Hagood with test suggested by Dan Kegel.
parent
b997cd76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
file.c
dlls/msvcrt/file.c
+13
-0
file.c
dlls/msvcrt/tests/file.c
+48
-0
No files found.
dlls/msvcrt/file.c
View file @
4d3952f3
...
...
@@ -1634,6 +1634,19 @@ static int read_i(int fd, void *buf, unsigned int count)
*/
if
(
ReadFile
(
hand
,
bufstart
,
count
,
&
num_read
,
NULL
))
{
if
(
MSVCRT_fdesc
[
fd
].
wxflag
&
WX_TEXT
)
{
int
i
;
/* in text mode, a ctrl-z signals EOF */
for
(
i
=
0
;
i
<
num_read
;
i
++
)
{
if
(
bufstart
[
i
]
==
0x1a
)
{
num_read
=
i
;
break
;
}
}
}
if
(
num_read
!=
count
)
{
MSVCRT_fdesc
[
fd
].
wxflag
|=
WX_ATEOF
;
...
...
dlls/msvcrt/tests/file.c
View file @
4d3952f3
...
...
@@ -372,6 +372,53 @@ static void test_fgetwc( void )
unlink
(
tempf
);
}
static
void
test_ctrlz
(
void
)
{
char
*
tempf
;
FILE
*
tempfh
;
static
const
char
mytext
[]
=
"This is test_ctrlz"
;
char
buffer
[
256
];
int
i
,
j
;
long
l
;
tempf
=
_tempnam
(
"."
,
"wne"
);
tempfh
=
fopen
(
tempf
,
"wb"
);
fputs
(
mytext
,
tempfh
);
j
=
0x1a
;
/* a ctrl-z character signals EOF in text mode */
fputc
(
j
,
tempfh
);
j
=
'\r'
;
fputc
(
j
,
tempfh
);
j
=
'\n'
;
fputc
(
j
,
tempfh
);
j
=
'a'
;
fputc
(
j
,
tempfh
);
fclose
(
tempfh
);
tempfh
=
fopen
(
tempf
,
"rt"
);
/* open in TEXT mode */
ok
(
fgets
(
buffer
,
256
,
tempfh
)
!=
0
,
"fgets failed unexpected
\n
"
);
i
=
strlen
(
buffer
);
j
=
strlen
(
mytext
);
ok
(
i
==
j
,
"returned string length expected %d got %d
\n
"
,
j
,
i
);
j
+=
4
;
/* ftell should indicate the true end of file */
l
=
ftell
(
tempfh
);
ok
(
l
==
j
,
"ftell expected %d got %ld
\n
"
,
j
,
l
);
ok
(
feof
(
tempfh
),
"did not get EOF
\n
"
);
fclose
(
tempfh
);
tempfh
=
fopen
(
tempf
,
"rb"
);
/* open in BINARY mode */
ok
(
fgets
(
buffer
,
256
,
tempfh
)
!=
0
,
"fgets failed unexpected
\n
"
);
i
=
strlen
(
buffer
);
j
=
strlen
(
mytext
)
+
3
;
/* should get through newline */
ok
(
i
==
j
,
"returned string length expected %d got %d
\n
"
,
j
,
i
);
l
=
ftell
(
tempfh
);
ok
(
l
==
j
,
"ftell expected %d got %ld
\n
"
,
j
,
l
);
ok
(
fgets
(
buffer
,
256
,
tempfh
)
!=
0
,
"fgets failed unexpected
\n
"
);
i
=
strlen
(
buffer
);
ok
(
i
==
1
,
"returned string length expected %d got %d
\n
"
,
1
,
i
);
ok
(
feof
(
tempfh
),
"did not get EOF
\n
"
);
fclose
(
tempfh
);
unlink
(
tempf
);
}
static
void
test_file_put_get
(
void
)
{
char
*
tempf
;
...
...
@@ -727,6 +774,7 @@ START_TEST(file)
test_readmode
(
FALSE
);
/* binary mode */
test_readmode
(
TRUE
);
/* ascii mode */
test_fgetwc
();
test_ctrlz
();
test_file_put_get
();
test_tmpnam
();
test_get_osfhandle
();
...
...
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