mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[win32] Moved code.
This commit is contained in:
parent
5274a0fe19
commit
968562d2d1
@ -551,12 +551,18 @@ select_read(int fd, struct fd_set *rd)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
HANDLE hnd = (HANDLE) fd;
|
HANDLE hnd = (HANDLE) fd;
|
||||||
|
|
||||||
if (hnd == GetStdHandle(STD_INPUT_HANDLE)) {
|
if (GetFileType(hnd) == FILE_TYPE_PIPE) {
|
||||||
|
DWORD read = 0;
|
||||||
|
if (PeekNamedPipe(hnd, NULL, 0, NULL, &read, NULL)
|
||||||
|
&& read > 0) {
|
||||||
|
FD_SET (fd, rd);
|
||||||
|
rc++;
|
||||||
|
}
|
||||||
|
} else if (hnd == GetStdHandle(STD_INPUT_HANDLE)) {
|
||||||
if (console_peek(hnd)) {
|
if (console_peek(hnd)) {
|
||||||
FD_SET(fd, rd);
|
FD_SET(fd, rd);
|
||||||
rc++;
|
rc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
hnd = (HANDLE) _get_osfhandle(fd);
|
hnd = (HANDLE) _get_osfhandle(fd);
|
||||||
if (WaitForSingleObject(hnd, 0) == WAIT_OBJECT_0) {
|
if (WaitForSingleObject(hnd, 0) == WAIT_OBJECT_0) {
|
||||||
@ -576,21 +582,10 @@ select_one_loop(int num_fds, struct fd_set *rd, struct fd_set *wr,
|
|||||||
int rc, fd;
|
int rc, fd;
|
||||||
|
|
||||||
for (rc = fd = 0; fd < num_fds; fd++) {
|
for (rc = fd = 0; fd < num_fds; fd++) {
|
||||||
HANDLE hnd = (HANDLE)fd;
|
if (fd < SOCK_SHIFT) {
|
||||||
|
|
||||||
if (GetFileType(hnd) == FILE_TYPE_PIPE) {
|
|
||||||
DWORD read = 0;
|
|
||||||
if (PeekNamedPipe(hnd, NULL, 0, NULL, &read, NULL)
|
|
||||||
&& read > 0) {
|
|
||||||
FD_SET (fd, rd);
|
|
||||||
rc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (fd < SOCK_SHIFT) {
|
|
||||||
rc += select_read(fd, rd);
|
rc += select_read(fd, rd);
|
||||||
if (wr && FD_ISSET(fd,wr))
|
if (wr && FD_ISSET(fd,wr))
|
||||||
rc++; /* assume always writable */
|
rc++; /* assume always writable */
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* A Winsock socket */
|
/* A Winsock socket */
|
||||||
fd_set sock_rd, sock_wr, sock_ex;
|
fd_set sock_rd, sock_wr, sock_ex;
|
||||||
|
Loading…
Reference in New Issue
Block a user