26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ |
29 */ |
30 |
30 |
31 #include "main.h" |
|
32 |
|
33 #ifndef _WIN32 |
31 #ifndef _WIN32 |
34 # include <sys/select.h> |
32 # include <sys/select.h> |
35 #else |
33 #else |
36 # include <winsock2.h> |
34 # include <winsock2.h> |
37 #endif |
35 #endif |
38 |
36 |
39 #include <time.h> |
37 #include "main.h" |
40 #include "network/rconsession.h" |
38 #include "network/rconsession.h" |
41 #include "huffman.h" |
39 #include "huffman.h" |
42 #include "interface.h" |
40 #include "interface.h" |
43 |
41 |
44 // ------------------------------------------------------------------------------------------------- |
42 // ------------------------------------------------------------------------------------------------- |
45 // |
43 // |
46 FUNCTION |
44 int main (int argc, char* argv[]) |
47 main (int argc, char* argv[]) -> int |
|
48 { |
45 { |
49 #ifdef _WIN32 |
46 #ifdef _WIN32 |
|
47 # ifdef HAVE_PDCURSES_WIN32A |
|
48 // PDCurses-win32a uses a GUI window of its own so we need to destroy the console window. |
50 FreeConsole(); |
49 FreeConsole(); |
|
50 # endif |
51 |
51 |
52 WSADATA wsaData; |
52 WSADATA wsaData; |
53 int result = WSAStartup (MAKEWORD (2, 2), &wsaData); |
53 int result = WSAStartup (MAKEWORD (2, 2), &wsaData); |
54 |
54 |
55 if (result != 0) |
55 if (result != 0) |
83 timeout.tv_usec = 250000; // 0.25 seconds |
83 timeout.tv_usec = 250000; // 0.25 seconds |
84 FD_ZERO (&fdset); |
84 FD_ZERO (&fdset); |
85 FD_SET (0, &fdset); |
85 FD_SET (0, &fdset); |
86 |
86 |
87 int fd = iface.get_session()->socket()->file_descriptor(); |
87 int fd = iface.get_session()->socket()->file_descriptor(); |
88 highest = max (highest, fd); |
88 highest = zfc::max (highest, fd); |
89 FD_SET (fd, &fdset); |
89 FD_SET (fd, &fdset); |
90 |
90 |
91 select (highest + 1, &fdset, nullptr, nullptr, &timeout); |
91 select (highest + 1, &fdset, nullptr, nullptr, &timeout); |
92 |
92 |
93 if (FD_ISSET (0, &fdset)) |
93 if (FD_ISSET (0, &fdset)) |