Commit a7e8ae9e18e0a3deb118af9d1c55aeb8a8317b60
1 parent
edc121a5
Exists in
master
and in
3 other branches
Removendo warnings em windows, incluindo suporte a sessoes em net_connect()
Showing
3 changed files
with
114 additions
and
155 deletions
Show diff stats
host.c
| @@ -569,7 +569,7 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -569,7 +569,7 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 569 | 569 | ||
| 570 | /* Attempt contact. */ | 570 | /* Attempt contact. */ |
| 571 | hSession->ever_3270 = False; | 571 | hSession->ever_3270 = False; |
| 572 | - hSession->net_sock = net_connect(chost, port, localprocess_cmd != CN, &resolving,&pending); | 572 | + hSession->net_sock = net_connect(hSession, chost, port, localprocess_cmd != CN, &resolving,&pending); |
| 573 | 573 | ||
| 574 | if (hSession->net_sock < 0 && !resolving) | 574 | if (hSession->net_sock < 0 && !resolving) |
| 575 | { | 575 | { |
telnet.c
| @@ -353,8 +353,7 @@ static void output_possible(H3270 *session); | @@ -353,8 +353,7 @@ static void output_possible(H3270 *session); | ||
| 353 | 353 | ||
| 354 | 354 | ||
| 355 | #if defined(_WIN32) /*[*/ | 355 | #if defined(_WIN32) /*[*/ |
| 356 | -void | ||
| 357 | -sockstart(void) | 356 | +void sockstart(H3270 *session) |
| 358 | { | 357 | { |
| 359 | static int initted = 0; | 358 | static int initted = 0; |
| 360 | WORD wVersionRequested; | 359 | WORD wVersionRequested; |
| @@ -367,15 +366,24 @@ sockstart(void) | @@ -367,15 +366,24 @@ sockstart(void) | ||
| 367 | 366 | ||
| 368 | wVersionRequested = MAKEWORD(2, 2); | 367 | wVersionRequested = MAKEWORD(2, 2); |
| 369 | 368 | ||
| 370 | - if (WSAStartup(wVersionRequested, &wsaData) != 0) { | ||
| 371 | - #warning Notify User | ||
| 372 | - fprintf(stderr, "WSAStartup failed: %s\n",win32_strerror(GetLastError())); | 369 | + if (WSAStartup(wVersionRequested, &wsaData) != 0) |
| 370 | + { | ||
| 371 | + lib3270_popup_dialog( session, | ||
| 372 | + LIB3270_NOTIFY_CRITICAL, | ||
| 373 | + N_( "Network startup error" ), | ||
| 374 | + N_( "WSAStartup failed" ), | ||
| 375 | + "%s", win32_strerror(GetLastError()) ); | ||
| 376 | + | ||
| 373 | _exit(1); | 377 | _exit(1); |
| 374 | } | 378 | } |
| 375 | 379 | ||
| 376 | - if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { | ||
| 377 | - #warning Notify User | ||
| 378 | - fprintf(stderr, "Bad winsock version: %d.%d\n",LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion)); | 380 | + if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) |
| 381 | + { | ||
| 382 | + lib3270_popup_dialog( session, | ||
| 383 | + LIB3270_NOTIFY_CRITICAL, | ||
| 384 | + N_( "Network startup error" ), | ||
| 385 | + N_( "Bad winsock version" ), | ||
| 386 | + N_( "Can´t use winsock version %d.%d" ), LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion)); | ||
| 379 | _exit(1); | 387 | _exit(1); |
| 380 | } | 388 | } |
| 381 | } | 389 | } |
| @@ -408,13 +416,18 @@ void popup_a_sockerr(H3270 *session, char *fmt, ...) | @@ -408,13 +416,18 @@ void popup_a_sockerr(H3270 *session, char *fmt, ...) | ||
| 408 | 416 | ||
| 409 | } | 417 | } |
| 410 | 418 | ||
| 411 | -/* | ||
| 412 | - * net_connect | ||
| 413 | - * Establish a telnet socket to the given host passed as an argument. | 419 | +/** |
| 420 | + * Establish a telnet socket to the given host passed as an argument. | ||
| 421 | + * | ||
| 414 | * Called only once and is responsible for setting up the telnet | 422 | * Called only once and is responsible for setting up the telnet |
| 415 | - * variables. Returns the file descriptor of the connected socket. | 423 | + * variables. |
| 424 | + * | ||
| 425 | + * @param session Handle to the session descriptor. | ||
| 426 | + * | ||
| 427 | + * | ||
| 428 | + * @return The file descriptor of the connected socket. | ||
| 416 | */ | 429 | */ |
| 417 | -int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving, Boolean *pending) | 430 | +int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Boolean *resolving, Boolean *pending) |
| 418 | { | 431 | { |
| 419 | struct servent *sp; | 432 | struct servent *sp; |
| 420 | struct hostent *hp; | 433 | struct hostent *hp; |
| @@ -427,11 +440,11 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving | @@ -427,11 +440,11 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving | ||
| 427 | int mtu = OMTU; | 440 | int mtu = OMTU; |
| 428 | #endif /*]*/ | 441 | #endif /*]*/ |
| 429 | 442 | ||
| 430 | -# define close_fail { (void) SOCK_CLOSE(h3270.sock); h3270.sock = -1; return -1; } | 443 | +#define close_fail { (void) SOCK_CLOSE(session->sock); session->sock = -1; return -1; } |
| 431 | 444 | ||
| 432 | -#if defined(_WIN32) /*[*/ | ||
| 433 | - sockstart(); | ||
| 434 | -#endif /*]*/ | 445 | +#if defined(_WIN32) |
| 446 | + sockstart(session); | ||
| 447 | +#endif | ||
| 435 | 448 | ||
| 436 | if (netrbuf == (unsigned char *)NULL) | 449 | if (netrbuf == (unsigned char *)NULL) |
| 437 | netrbuf = (unsigned char *)Malloc(BUFSZ); | 450 | netrbuf = (unsigned char *)Malloc(BUFSZ); |
| @@ -453,10 +466,10 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving | @@ -453,10 +466,10 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving | ||
| 453 | *resolving = False; | 466 | *resolving = False; |
| 454 | *pending = False; | 467 | *pending = False; |
| 455 | 468 | ||
| 456 | - Replace(h3270.hostname, NewString(host)); | 469 | + Replace(session->hostname, NewString(host)); |
| 457 | 470 | ||
| 458 | /* get the passthru host and port number */ | 471 | /* get the passthru host and port number */ |
| 459 | - if (h3270.passthru_host) { | 472 | + if (session->passthru_host) { |
| 460 | const char *hn; | 473 | const char *hn; |
| 461 | 474 | ||
| 462 | hn = getenv("INTERNET_HOST"); | 475 | hn = getenv("INTERNET_HOST"); |
| @@ -491,9 +504,9 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving | @@ -491,9 +504,9 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving | ||
| 491 | "or service: %s", portname); | 504 | "or service: %s", portname); |
| 492 | return -1; | 505 | return -1; |
| 493 | } | 506 | } |
| 494 | - h3270.current_port = ntohs(sp->s_port); | 507 | + session->current_port = ntohs(sp->s_port); |
| 495 | } else | 508 | } else |
| 496 | - h3270.current_port = (unsigned short)lport; | 509 | + session->current_port = (unsigned short)lport; |
| 497 | } | 510 | } |
| 498 | if (proxy_type < 0) | 511 | if (proxy_type < 0) |
| 499 | return -1; | 512 | return -1; |
| @@ -501,199 +514,142 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving | @@ -501,199 +514,142 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving | ||
| 501 | 514 | ||
| 502 | /* fill in the socket address of the given host */ | 515 | /* fill in the socket address of the given host */ |
| 503 | (void) memset((char *) &haddr, 0, sizeof(haddr)); | 516 | (void) memset((char *) &haddr, 0, sizeof(haddr)); |
| 504 | - if (h3270.passthru_host) { | 517 | + if (session->passthru_host) { |
| 505 | haddr.sin.sin_family = AF_INET; | 518 | haddr.sin.sin_family = AF_INET; |
| 506 | (void) memmove(&haddr.sin.sin_addr, passthru_haddr, | 519 | (void) memmove(&haddr.sin.sin_addr, passthru_haddr, |
| 507 | passthru_len); | 520 | passthru_len); |
| 508 | haddr.sin.sin_port = passthru_port; | 521 | haddr.sin.sin_port = passthru_port; |
| 509 | ha_len = sizeof(struct sockaddr_in); | 522 | ha_len = sizeof(struct sockaddr_in); |
| 510 | } else if (proxy_type > 0) { | 523 | } else if (proxy_type > 0) { |
| 511 | - status_resolving(&h3270,1); | 524 | + status_resolving(session,1); |
| 512 | if (resolve_host_and_port(proxy_host, proxy_portname, | 525 | if (resolve_host_and_port(proxy_host, proxy_portname, |
| 513 | &proxy_port, &haddr.sa, &ha_len, errmsg, | 526 | &proxy_port, &haddr.sa, &ha_len, errmsg, |
| 514 | sizeof(errmsg)) < 0) { | 527 | sizeof(errmsg)) < 0) { |
| 515 | popup_an_error(NULL,errmsg); | 528 | popup_an_error(NULL,errmsg); |
| 516 | - status_resolving(&h3270,0); | 529 | + status_resolving(session,0); |
| 517 | return -1; | 530 | return -1; |
| 518 | - status_resolving(&h3270,0); | 531 | + status_resolving(session,0); |
| 519 | } | 532 | } |
| 520 | } else { | 533 | } else { |
| 521 | -/* | ||
| 522 | -#if defined(LOCAL_PROCESS) | ||
| 523 | - if (ls) { | ||
| 524 | - local_process = True; | ||
| 525 | - } else { | ||
| 526 | -#endif | ||
| 527 | -#if defined(LOCAL_PROCESS) | ||
| 528 | - local_process = False; | ||
| 529 | -#endif | ||
| 530 | -*/ | ||
| 531 | - status_resolving(&h3270,1); | 534 | + status_resolving(session,1); |
| 532 | if (resolve_host_and_port(host, portname, | 535 | if (resolve_host_and_port(host, portname, |
| 533 | - &h3270.current_port, &haddr.sa, &ha_len, | 536 | + &session->current_port, &haddr.sa, &ha_len, |
| 534 | errmsg, sizeof(errmsg)) < 0) { | 537 | errmsg, sizeof(errmsg)) < 0) { |
| 535 | - popup_an_error(NULL,errmsg); | 538 | + popup_an_error(session,errmsg); |
| 536 | status_resolving(&h3270,0); | 539 | status_resolving(&h3270,0); |
| 537 | return -1; | 540 | return -1; |
| 538 | - status_resolving(&h3270,0); | 541 | + status_resolving(session,0); |
| 539 | } | 542 | } |
| 540 | -/* | ||
| 541 | -#if defined(LOCAL_PROCESS) | ||
| 542 | - } | ||
| 543 | -#endif | ||
| 544 | -*/ | ||
| 545 | } | 543 | } |
| 546 | 544 | ||
| 547 | -/* | ||
| 548 | -#if defined(LOCAL_PROCESS) | ||
| 549 | - if (local_process) { | ||
| 550 | - int amaster; | ||
| 551 | - struct winsize w; | ||
| 552 | - | ||
| 553 | - w.ws_row = XMIT_ROWS; | ||
| 554 | - w.ws_col = XMIT_COLS; | ||
| 555 | - w.ws_xpixel = 0; | ||
| 556 | - w.ws_ypixel = 0; | ||
| 557 | - | ||
| 558 | - switch (forkpty(&amaster, NULL, NULL, &w)) { | ||
| 559 | - case -1: // failed | ||
| 560 | - popup_an_errno(errno, "forkpty"); | ||
| 561 | - close_fail; | ||
| 562 | - case 0: // child | ||
| 563 | - putenv("TERM=xterm"); | ||
| 564 | - if (strchr(host, ' ') != CN) { | ||
| 565 | - (void) execlp("/bin/sh", "sh", "-c", host, | ||
| 566 | - NULL); | ||
| 567 | - } else { | ||
| 568 | - char *arg1; | ||
| 569 | - | ||
| 570 | - arg1 = strrchr(host, '/'); | ||
| 571 | - (void) execlp(host, | ||
| 572 | - (arg1 == CN) ? host : arg1 + 1, | ||
| 573 | - NULL); | ||
| 574 | - } | ||
| 575 | - perror(host); | ||
| 576 | - #warning Notify User | ||
| 577 | - _exit(1); | ||
| 578 | - break; | ||
| 579 | - default: // parent | ||
| 580 | - sock = amaster; | ||
| 581 | -#if !defined(_WIN32) | ||
| 582 | - (void) fcntl(sock, F_SETFD, 1); | ||
| 583 | -#endif | ||
| 584 | - net_connected(); | ||
| 585 | - host_in3270(CONNECTED_ANSI); | ||
| 586 | - break; | ||
| 587 | - } | ||
| 588 | - } else { | ||
| 589 | -#endif | ||
| 590 | -*/ | ||
| 591 | - /* create the socket */ | ||
| 592 | - if ((h3270.sock = socket(haddr.sa.sa_family, SOCK_STREAM, 0)) == -1) { | ||
| 593 | - popup_a_sockerr(NULL, N_( "socket" ) ); | ||
| 594 | - return -1; | ||
| 595 | - } | 545 | + /* create the socket */ |
| 546 | + if ((session->sock = socket(haddr.sa.sa_family, SOCK_STREAM, 0)) == -1) { | ||
| 547 | + popup_a_sockerr(session, N_( "socket" ) ); | ||
| 548 | + return -1; | ||
| 549 | + } | ||
| 596 | 550 | ||
| 597 | - /* set options for inline out-of-band data and keepalives */ | ||
| 598 | - if (setsockopt(h3270.sock, SOL_SOCKET, SO_OOBINLINE, (char *)&on, | ||
| 599 | - sizeof(on)) < 0) { | ||
| 600 | - popup_a_sockerr(NULL, N_( "setsockopt(%s)" ), "SO_OOBINLINE"); | ||
| 601 | - close_fail; | ||
| 602 | - } | ||
| 603 | - if (setsockopt(h3270.sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, | ||
| 604 | - sizeof(on)) < 0) { | ||
| 605 | - popup_a_sockerr(NULL, N_( "setsockopt(%s)" ), "SO_KEEPALIVE"); | ||
| 606 | - close_fail; | ||
| 607 | - } | 551 | + /* set options for inline out-of-band data and keepalives */ |
| 552 | + if (setsockopt(session->sock, SOL_SOCKET, SO_OOBINLINE, (char *)&on, | ||
| 553 | + sizeof(on)) < 0) { | ||
| 554 | + popup_a_sockerr(session, N_( "setsockopt(%s)" ), "SO_OOBINLINE"); | ||
| 555 | + close_fail; | ||
| 556 | + } | ||
| 557 | + if (setsockopt(session->sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, | ||
| 558 | + sizeof(on)) < 0) { | ||
| 559 | + popup_a_sockerr(session, N_( "setsockopt(%s)" ), "SO_KEEPALIVE"); | ||
| 560 | + close_fail; | ||
| 561 | + } | ||
| 608 | #if defined(OMTU) /*[*/ | 562 | #if defined(OMTU) /*[*/ |
| 609 | - if (setsockopt(h3270.sock, SOL_SOCKET, SO_SNDBUF, (char *)&mtu, | ||
| 610 | - sizeof(mtu)) < 0) { | ||
| 611 | - popup_a_sockerr( N_( "setsockopt(%s)" ), "SO_SNDBUF"); | ||
| 612 | - close_fail; | ||
| 613 | - } | 563 | + if (setsockopt(session->sock, SOL_SOCKET, SO_SNDBUF, (char *)&mtu,sizeof(mtu)) < 0) |
| 564 | + { | ||
| 565 | + popup_a_sockerr(session, N_( "setsockopt(%s)" ), "SO_SNDBUF"); | ||
| 566 | + close_fail; | ||
| 567 | + } | ||
| 614 | #endif /*]*/ | 568 | #endif /*]*/ |
| 615 | 569 | ||
| 616 | - /* set the socket to be non-delaying */ | 570 | + /* set the socket to be non-delaying */ |
| 617 | #if defined(_WIN32) /*[*/ | 571 | #if defined(_WIN32) /*[*/ |
| 618 | - if (non_blocking(False) < 0) | 572 | + if (non_blocking(False) < 0) |
| 619 | #else /*][*/ | 573 | #else /*][*/ |
| 620 | - if (non_blocking(True) < 0) | 574 | + if (non_blocking(True) < 0) |
| 621 | #endif /*]*/ | 575 | #endif /*]*/ |
| 622 | - close_fail; | 576 | + close_fail; |
| 623 | 577 | ||
| 624 | #if !defined(_WIN32) /*[*/ | 578 | #if !defined(_WIN32) /*[*/ |
| 625 | - /* don't share the socket with our children */ | ||
| 626 | - (void) fcntl(h3270.sock, F_SETFD, 1); | 579 | + /* don't share the socket with our children */ |
| 580 | + (void) fcntl(session->sock, F_SETFD, 1); | ||
| 627 | #endif /*]*/ | 581 | #endif /*]*/ |
| 628 | 582 | ||
| 629 | - /* init ssl */ | 583 | + /* init ssl */ |
| 630 | #if defined(HAVE_LIBSSL) /*[*/ | 584 | #if defined(HAVE_LIBSSL) /*[*/ |
| 631 | - last_ssl_error = 0; | ||
| 632 | - if (h3270.ssl_host) | ||
| 633 | - ssl_init(); | 585 | + last_ssl_error = 0; |
| 586 | + if (session->ssl_host) | ||
| 587 | + ssl_init(); | ||
| 634 | #endif /*]*/ | 588 | #endif /*]*/ |
| 635 | 589 | ||
| 636 | - /* connect */ | ||
| 637 | - status_connecting(&h3270,1); | ||
| 638 | - if (connect(h3270.sock, &haddr.sa, ha_len) == -1) { | ||
| 639 | - if (socket_errno() == SE_EWOULDBLOCK | 590 | + /* connect */ |
| 591 | + status_connecting(session,1); | ||
| 592 | + if (connect(session->sock, &haddr.sa, ha_len) == -1) { | ||
| 593 | + if (socket_errno() == SE_EWOULDBLOCK | ||
| 640 | #if defined(SE_EINPROGRESS) /*[*/ | 594 | #if defined(SE_EINPROGRESS) /*[*/ |
| 641 | - || socket_errno() == SE_EINPROGRESS | 595 | + || socket_errno() == SE_EINPROGRESS |
| 642 | #endif /*]*/ | 596 | #endif /*]*/ |
| 643 | ) { | 597 | ) { |
| 644 | - trace_dsn("Connection pending.\n"); | ||
| 645 | - *pending = True; | 598 | + trace_dsn("Connection pending.\n"); |
| 599 | + *pending = True; | ||
| 646 | #if !defined(_WIN32) /*[*/ | 600 | #if !defined(_WIN32) /*[*/ |
| 647 | - output_id = AddOutput(h3270.sock, &h3270, output_possible); | 601 | + output_id = AddOutput(session->sock, session, output_possible); |
| 648 | #endif /*]*/ | 602 | #endif /*]*/ |
| 649 | - } else { | ||
| 650 | - popup_a_sockerr(NULL, N_( "Can't connect to %s:%d" ),h3270.hostname, h3270.current_port); | ||
| 651 | - close_fail; | ||
| 652 | - } | ||
| 653 | } else { | 603 | } else { |
| 654 | - if (non_blocking(False) < 0) | ||
| 655 | - close_fail; | ||
| 656 | - net_connected(&h3270); | 604 | + popup_a_sockerr(session, N_( "Can't connect to %s:%d" ),session->hostname, session->current_port); |
| 605 | + close_fail; | ||
| 657 | } | 606 | } |
| 658 | -/* | ||
| 659 | -#if defined(LOCAL_PROCESS) | 607 | + } else { |
| 608 | + if (non_blocking(False) < 0) | ||
| 609 | + close_fail; | ||
| 610 | + net_connected(session); | ||
| 660 | } | 611 | } |
| 661 | -#endif | ||
| 662 | -*/ | ||
| 663 | 612 | ||
| 664 | /* set up temporary termtype */ | 613 | /* set up temporary termtype */ |
| 665 | - if (appres.termname == CN && h3270.std_ds_host) { | 614 | + if (appres.termname == CN && session->std_ds_host) { |
| 666 | (void) sprintf(ttype_tmpval, "IBM-327%c-%d", | 615 | (void) sprintf(ttype_tmpval, "IBM-327%c-%d", |
| 667 | - appres.m3279 ? '9' : '8', h3270.model_num); | ||
| 668 | - h3270.termtype = ttype_tmpval; | 616 | + appres.m3279 ? '9' : '8', session->model_num); |
| 617 | + session->termtype = ttype_tmpval; | ||
| 669 | } | 618 | } |
| 670 | 619 | ||
| 671 | /* all done */ | 620 | /* all done */ |
| 672 | #if defined(_WIN32) /*[*/ | 621 | #if defined(_WIN32) /*[*/ |
| 673 | - if (h3270.sock_handle == NULL) { | 622 | + if (session->sock_handle == NULL) { |
| 674 | char ename[256]; | 623 | char ename[256]; |
| 675 | 624 | ||
| 676 | sprintf(ename, "wc3270-%d", getpid()); | 625 | sprintf(ename, "wc3270-%d", getpid()); |
| 677 | 626 | ||
| 678 | - h3270.sock_handle = CreateEvent(NULL, TRUE, FALSE, ename); | ||
| 679 | - if (h3270.sock_handle == NULL) | 627 | + session->sock_handle = CreateEvent(NULL, TRUE, FALSE, ename); |
| 628 | + if (session->sock_handle == NULL) | ||
| 680 | { | 629 | { |
| 681 | - #warning Notify User | ||
| 682 | - Log("Cannot create socket handle: %s\n",win32_strerror(GetLastError())); | 630 | + lib3270_popup_dialog( session, |
| 631 | + LIB3270_NOTIFY_CRITICAL, | ||
| 632 | + N_( "Network startup error" ), | ||
| 633 | + N_( "Cannot create socket handle" ), | ||
| 634 | + "%s", win32_strerror(GetLastError()) ); | ||
| 635 | + | ||
| 683 | _exit(1); | 636 | _exit(1); |
| 684 | } | 637 | } |
| 685 | } | 638 | } |
| 686 | 639 | ||
| 687 | - if (WSAEventSelect(h3270.sock, h3270.sock_handle, FD_READ | FD_CONNECT | FD_CLOSE) != 0) | 640 | + if (WSAEventSelect(session->sock, session->sock_handle, FD_READ | FD_CONNECT | FD_CLOSE) != 0) |
| 688 | { | 641 | { |
| 689 | - #warning Notify User | ||
| 690 | - Log("WSAEventSelect failed: %s\n",win32_strerror(GetLastError())); | 642 | + lib3270_popup_dialog( session, |
| 643 | + LIB3270_NOTIFY_CRITICAL, | ||
| 644 | + N_( "Network startup error" ), | ||
| 645 | + N_( "WSAEventSelect failed" ), | ||
| 646 | + "%s", win32_strerror(GetLastError()) ); | ||
| 691 | _exit(1); | 647 | _exit(1); |
| 692 | } | 648 | } |
| 693 | 649 | ||
| 694 | - return (int) h3270.sock_handle; | 650 | + return (int) session->sock_handle; |
| 695 | #else /*][*/ | 651 | #else /*][*/ |
| 696 | - return h3270.sock; | 652 | + return session->sock; |
| 697 | #endif /*]*/ | 653 | #endif /*]*/ |
| 698 | } | 654 | } |
| 699 | #undef close_fail | 655 | #undef close_fail |
| @@ -953,8 +909,11 @@ void net_input(H3270 *session) | @@ -953,8 +909,11 @@ void net_input(H3270 *session) | ||
| 953 | case WSAEINVAL: | 909 | case WSAEINVAL: |
| 954 | return; | 910 | return; |
| 955 | default: | 911 | default: |
| 956 | - #warning Notify User! | ||
| 957 | - Log("second connect() failed: %s\n",win32_strerror(err)); | 912 | + lib3270_popup_dialog( &h3270, |
| 913 | + LIB3270_NOTIFY_CRITICAL, | ||
| 914 | + N_( "Network startup error" ), | ||
| 915 | + N_( "Second connect() failed" ), | ||
| 916 | + "%s", win32_strerror(GetLastError()) ); | ||
| 958 | _exit(1); | 917 | _exit(1); |
| 959 | } | 918 | } |
| 960 | } | 919 | } |
telnetc.h
| @@ -34,7 +34,7 @@ LIB3270_INTERNAL Boolean net_add_dummy_tn3270e(void); | @@ -34,7 +34,7 @@ LIB3270_INTERNAL Boolean net_add_dummy_tn3270e(void); | ||
| 34 | LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); | 34 | LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); |
| 35 | LIB3270_INTERNAL void net_break(void); | 35 | LIB3270_INTERNAL void net_break(void); |
| 36 | LIB3270_INTERNAL void net_charmode(void); | 36 | LIB3270_INTERNAL void net_charmode(void); |
| 37 | -LIB3270_INTERNAL int net_connect(const char *, char *, Boolean, Boolean *, Boolean *); | 37 | +LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); |
| 38 | LIB3270_INTERNAL void net_disconnect(void); | 38 | LIB3270_INTERNAL void net_disconnect(void); |
| 39 | LIB3270_INTERNAL void net_exception(H3270 *session); | 39 | LIB3270_INTERNAL void net_exception(H3270 *session); |
| 40 | LIB3270_INTERNAL void net_hexansi_out(unsigned char *buf, int len); | 40 | LIB3270_INTERNAL void net_hexansi_out(unsigned char *buf, int len); |